@waline/client 2.14.1 → 2.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.cjs +1 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +22 -20
- package/dist/api.d.mts +22 -20
- package/dist/api.d.ts +22 -20
- package/dist/api.mjs +1 -1
- package/dist/api.mjs.map +1 -1
- package/dist/comment.cjs +1 -1
- package/dist/comment.cjs.map +1 -1
- package/dist/comment.d.cts +1 -1
- package/dist/comment.d.mts +1 -1
- package/dist/comment.d.ts +1 -1
- package/dist/comment.js +1 -68
- package/dist/comment.js.map +1 -1
- package/dist/comment.mjs +1 -1
- package/dist/comment.mjs.map +1 -1
- package/dist/component.mjs +1 -1
- package/dist/component.mjs.map +1 -1
- package/dist/legacy.umd.d.ts +15 -6
- package/dist/legacy.umd.js +1 -1
- package/dist/legacy.umd.js.map +1 -1
- package/dist/pageview.cjs +1 -1
- package/dist/pageview.cjs.map +1 -1
- package/dist/pageview.d.cts +1 -1
- package/dist/pageview.d.mts +1 -1
- package/dist/pageview.d.ts +1 -1
- package/dist/pageview.js +1 -121
- package/dist/pageview.js.map +1 -1
- package/dist/pageview.mjs +1 -1
- package/dist/pageview.mjs.map +1 -1
- package/dist/shim.cjs +1 -1
- package/dist/shim.cjs.map +1 -1
- package/dist/shim.d.cts +20 -11
- package/dist/shim.d.mts +20 -11
- package/dist/shim.mjs +1 -1
- package/dist/shim.mjs.map +1 -1
- package/dist/waline.cjs +1 -1
- package/dist/waline.cjs.map +1 -1
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/dist/waline.d.cts +20 -11
- package/dist/waline.d.mts +20 -11
- package/dist/waline.d.ts +20 -11
- package/dist/waline.js +1 -6787
- package/dist/waline.js.map +1 -1
- package/dist/waline.mjs +1 -1
- package/dist/waline.mjs.map +1 -1
- package/package.json +28 -27
- package/src/api/comment.ts +25 -24
- package/src/comment.ts +3 -4
- package/src/components/ArticleReaction.vue +120 -117
- package/src/components/CommentBox.vue +451 -488
- package/src/components/CommentCard.vue +109 -98
- package/src/components/ImageWall.vue +132 -131
- package/src/components/WalineComment.vue +683 -0
- package/src/composables/index.ts +1 -2
- package/src/composables/reaction.ts +16 -0
- package/src/composables/recaptchaV3.ts +4 -6
- package/src/config/default.ts +6 -1
- package/src/config/i18n/index.ts +1 -0
- package/src/{entrys → entries}/api.ts +0 -0
- package/src/{entrys → entries}/comment.ts +0 -0
- package/src/entries/components.ts +2 -0
- package/src/{entrys → entries}/full.ts +0 -0
- package/src/{entrys → entries}/init.ts +0 -0
- package/src/{entrys → entries}/legacy.ts +0 -0
- package/src/{entrys → entries}/pageview.ts +0 -0
- package/src/init.ts +1 -1
- package/src/pageview.ts +2 -2
- package/src/styles/reaction.scss +27 -16
- package/src/typings/base.ts +5 -0
- package/src/typings/waline.ts +15 -6
- package/src/utils/config.ts +28 -6
- package/src/utils/image.ts +1 -1
- package/src/widgets/recentComments.ts +2 -2
- package/src/widgets/userList.ts +2 -2
- package/LICENSE +0 -339
- package/src/components/Waline.vue +0 -509
- package/src/composables/timeAgo.ts +0 -15
- package/src/composables/vote.ts +0 -20
- package/src/entrys/components.ts +0 -2
package/dist/shim.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
type WalineCommentSorting = 'latest' | 'oldest' | 'hottest';
|
|
2
|
+
type WalineEmojiPresets = `//${string}` | `http://${string}` | `https://${string}`;
|
|
2
3
|
interface WalineEmojiInfo {
|
|
3
4
|
/**
|
|
4
5
|
* 选项卡上的 Emoji 名称
|
|
@@ -335,7 +336,7 @@ interface WalineProps {
|
|
|
335
336
|
* - `'ru-ru'`
|
|
336
337
|
* - `'ru-RU'`
|
|
337
338
|
*
|
|
338
|
-
* @default
|
|
339
|
+
* @default navigator.language
|
|
339
340
|
*/
|
|
340
341
|
lang?: string;
|
|
341
342
|
/**
|
|
@@ -373,19 +374,23 @@ interface WalineProps {
|
|
|
373
374
|
*
|
|
374
375
|
* @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
|
|
375
376
|
*/
|
|
376
|
-
emoji?: (
|
|
377
|
+
emoji?: (WalineEmojiInfo | WalineEmojiPresets)[] | boolean;
|
|
377
378
|
/**
|
|
378
379
|
* 设置搜索功能
|
|
379
380
|
*
|
|
380
381
|
* Customize Search feature
|
|
382
|
+
*
|
|
383
|
+
* @default true
|
|
381
384
|
*/
|
|
382
|
-
search?: WalineSearchOptions |
|
|
385
|
+
search?: WalineSearchOptions | boolean;
|
|
383
386
|
/**
|
|
384
387
|
* 代码高亮
|
|
385
388
|
*
|
|
386
389
|
* Code highlighting
|
|
390
|
+
*
|
|
391
|
+
* @default true
|
|
387
392
|
*/
|
|
388
|
-
highlighter?: WalineHighlighter |
|
|
393
|
+
highlighter?: WalineHighlighter | boolean;
|
|
389
394
|
/**
|
|
390
395
|
* 自定义图片上传方法,方便更好的存储图片
|
|
391
396
|
*
|
|
@@ -394,14 +399,18 @@ interface WalineProps {
|
|
|
394
399
|
* Custom image upload callback to manage picture by yourself.
|
|
395
400
|
*
|
|
396
401
|
* We will pass a picture file object when execute it.
|
|
402
|
+
*
|
|
403
|
+
* @default true
|
|
397
404
|
*/
|
|
398
|
-
imageUploader?: WalineImageUploader |
|
|
405
|
+
imageUploader?: WalineImageUploader | boolean;
|
|
399
406
|
/**
|
|
400
407
|
* 自定义数学公式处理方法,用于预览。
|
|
401
408
|
*
|
|
402
409
|
* Custom math formula parse callback for preview.
|
|
410
|
+
*
|
|
411
|
+
* @default true
|
|
403
412
|
*/
|
|
404
|
-
texRenderer?: WalineTexRenderer |
|
|
413
|
+
texRenderer?: WalineTexRenderer | boolean;
|
|
405
414
|
/**
|
|
406
415
|
*
|
|
407
416
|
* 登录模式状态,可选值:
|
|
@@ -510,7 +519,7 @@ interface WalineCommentCountOptions {
|
|
|
510
519
|
*
|
|
511
520
|
* Language of error message
|
|
512
521
|
*
|
|
513
|
-
* @default
|
|
522
|
+
* @default navigator.language
|
|
514
523
|
*/
|
|
515
524
|
lang?: string;
|
|
516
525
|
}
|
|
@@ -582,7 +591,7 @@ interface WalinePageviewCountOptions {
|
|
|
582
591
|
*
|
|
583
592
|
* Language of error message
|
|
584
593
|
*
|
|
585
|
-
* @default
|
|
594
|
+
* @default navigator.language
|
|
586
595
|
*/
|
|
587
596
|
lang?: string;
|
|
588
597
|
}
|
|
@@ -614,7 +623,7 @@ interface WalineRecentCommentsOptions {
|
|
|
614
623
|
*
|
|
615
624
|
* Language of error message
|
|
616
625
|
*
|
|
617
|
-
* @default
|
|
626
|
+
* @default navigator.language
|
|
618
627
|
*/
|
|
619
628
|
lang?: string;
|
|
620
629
|
}
|
|
@@ -662,7 +671,7 @@ interface WalineUserListOptions {
|
|
|
662
671
|
*
|
|
663
672
|
* Language of error message
|
|
664
673
|
*
|
|
665
|
-
* @default
|
|
674
|
+
* @default navigator.language
|
|
666
675
|
*/
|
|
667
676
|
lang?: string;
|
|
668
677
|
/**
|
|
@@ -698,4 +707,4 @@ interface WalineUserListResult {
|
|
|
698
707
|
}
|
|
699
708
|
declare const UserList: ({ el, serverURL, count, locale, lang, mode, }: WalineUserListOptions) => Promise<WalineUserListResult>;
|
|
700
709
|
|
|
701
|
-
export { RecentComments, UserList, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineCommentSorting, WalineCommentStatus, WalineDateLocale, WalineEmojiInfo, WalineEmojiMaps, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLevelLocale, WalineLocale, WalineLoginStatus, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineReactionLocale, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineSearchImageData, WalineSearchOptions, WalineSearchResult, WalineTexRenderer, WalineUserListOptions, WalineUserListResult, commentCount, defaultLocales, init, pageviewCount, version };
|
|
710
|
+
export { RecentComments, UserList, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineCommentSorting, WalineCommentStatus, WalineDateLocale, WalineEmojiInfo, WalineEmojiMaps, WalineEmojiPresets, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLevelLocale, WalineLocale, WalineLoginStatus, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineReactionLocale, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineSearchImageData, WalineSearchOptions, WalineSearchResult, WalineTexRenderer, WalineUserListOptions, WalineUserListResult, commentCount, defaultLocales, init, pageviewCount, version };
|
package/dist/shim.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{computed as e,defineComponent as t,ref as n,inject as a,onMounted as o,watch as l,onUnmounted as i,openBlock as r,createElementBlock as s,createElementVNode as c,toDisplayString as u,Fragment as d,renderList as m,normalizeClass as p,createCommentVNode as g,h as v,onBeforeUnmount as h,nextTick as f,resolveComponent as w,normalizeStyle as y,createBlock as b,reactive as k,createVNode as C,withDirectives as L,vModelDynamic as $,vModelText as I,vShow as R,createTextVNode as S,provide as j,createApp as E,watchEffect as x}from"vue";import{useStorage as A,useNow as U,useDebounceFn as M,useStyleTag as z}from"@vueuse/core";import P from"autosize";import{marked as _}from"marked";const T=["nick","mail","link"],O=e=>e.filter((e=>T.includes(e))),H=e=>new Promise(((t,n)=>{if(e.size>128e3)return n(new Error("File too large! File size limit 128KB"));const a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result?.toString()||""),a.onerror=n})),D=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>',V=e=>{const t=async(t,n={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...n}).toString()}`).then((e=>e.json())).then((({data:e})=>e.map((e=>({title:e.title,src:e.images.downsized_medium.url})))));return{search:e=>t("search",{q:e,offset:"0"}),default:()=>t("trending",{}),more:(e,n=0)=>t("search",{q:e,offset:n.toString()})}},N=["//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"],B=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"),W=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],F={},G=e=>{let t=0;return e.replace(B,((e,n,a)=>{if(a)return`<span style="color: slategray">${a}</span>`;if("<"===n)return"<";let o;F[n]?o=F[n]:(o=W[t],F[n]=o);const l=`<span style="color: #${o}">${n}</span>`;return t=++t%W.length,l}))},K=["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"],q=e=>Object.fromEntries(e.map(((e,t)=>[K[t],e])));var Z=q(["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?"]),J=q(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),Y=q(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),X=q(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包","個人資料","通過","待審核","垃圾","取消置頂","按倒序","按正序","按熱度","你認為這篇文章怎麼樣?"]),Q=q(["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?"]),ee=q(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]);const te={zh:Y,"zh-cn":Y,"zh-CN":Y,"zh-tw":X,"zh-TW":X,en:Z,"en-US":Z,"en-us":Z,jp:J,"jp-jp":J,"jp-JP":J,"pt-br":Q,"pt-BR":Q,ru:ee,"ru-ru":ee,"ru-RU":ee},ne={"Content-Type":"application/json"},ae=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},oe=({serverURL:e,lang:t,paths:n,type:a,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())),le=({serverURL:e,lang:t,path:n,type:a,action:o})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:ne,body:JSON.stringify({path:n,type:a,action:o})}).then((e=>e.json())),ie=({serverURL:e,lang:t,token:n,objectId:a,...o})=>fetch(`${e}/comment/${a}?lang=${t}`,{method:"PUT",headers:{...ne,Authorization:`Bearer ${n}`},body:JSON.stringify(o)}).then((e=>e.json())).then((e=>ae(e,"Update comment"))),re=e=>{try{e=decodeURI(e)}catch(e){}return e},se=(e="")=>e.replace(/\/$/u,""),ce=e=>/^(https?:)?\/\//.test(e),ue=e=>{const t=se(e);return ce(t)?t:`https://${t}`},de=e=>Array.isArray(e)?e:!!e&&[0,e],me=(e,t)=>"function"==typeof e?e:!1!==e&&t,pe="{--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}",ge=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},ve=(e,t,n)=>{if(!e)return"";const a="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,o=t.getTime()-a.getTime(),l=Math.floor(o/864e5);if(0===l){const e=o%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,a=Math.floor(t/6e4);if(0===a){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${a} ${n.minutes}`}return`${t} ${n.hours}`}return l<0?n.now:l<8?`${l} ${n.days}`:(e=>{const t=ge(e.getDate(),2),n=ge(e.getMonth()+1,2);return`${ge(e.getFullYear(),2)}-${n}-${t}`})(a)},he=e=>{const t=A("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((a=>{const o={folder:e,...a};return n&&(t.value[e]=o),o}))},fe=(e,t="",n="",a="")=>`${t?`${t}/`:""}${n}${e}${a?`.${a}`:""}`,we=e=>{"AbortError"!==e.name&&console.error(e.message)},ye=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,be=e=>e.type.includes("image"),ke=e=>{const t=Array.from(e).find(be);return t?t.getAsFile():null},Ce=/\$.*?\$/,Le=/^\$(.*?)\$/,$e=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ie=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Re=(e,{emojiMap:t,highlighter:n,texRenderer:a})=>{if(_.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),a){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=$e.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(Ce);return-1!==t?t:e.length},tokenizer(t){const n=Le.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(a);_.use({extensions:e})}return _.parse(Ie(e,t))},Se=e=>e.dataset.path||e.getAttribute("id"),je=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:a="zh-CN"})=>{const o=new AbortController,l=document.querySelectorAll(n);return l.length&&(({serverURL:e,lang:t,paths:n,signal:a})=>fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:a}).then((e=>e.json())).then((e=>Array.isArray(e)?e:[e])))({serverURL:ue(e),paths:Array.from(l).map((e=>re(e.dataset.path||e.getAttribute("id")||t))),lang:a,signal:o.signal}).then((e=>{l.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(we),o.abort.bind(o)};let Ee=null;const xe=()=>Ee||(Ee=A("WALINE_LIKE",[]));var Ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ue={},Me={},ze={},Pe=Ae&&Ae.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},_e=Ae&&Ae.__generator||function(e,t){var n,a,o,l,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function r(l){return function(r){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,a&&(o=2&l[0]?a.return:l[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,l[1])).done)return o;switch(a=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,a=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],a=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,r])}}};Object.defineProperty(ze,"__esModule",{value:!0}),ze.ReCaptchaInstance=void 0;var Te=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 Pe(this,void 0,void 0,(function(){return _e(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}();ze.ReCaptchaInstance=Te,Object.defineProperty(Me,"__esModule",{value:!0}),Me.getInstance=Me.load=void 0;var Oe,He=ze;!function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(Oe||(Oe={}));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()===Oe.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===Oe.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(Oe.LOADING);var a=new e;return new Promise((function(o,l){a.loadScript(t,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then((function(){e.setLoadingState(Oe.LOADED);var l=a.doExplicitRender(grecaptcha,t,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),i=new He.ReCaptchaInstance(t,l,grecaptcha);e.successfulLoadingConsumers.forEach((function(e){return e(i)})),e.successfulLoadingConsumers=[],n.autoHideBadge&&i.hideBadge(),e.instance=i,o(i)})).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?Oe.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,n,a,o,l){var i=this;void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===o&&(o={}),void 0===l&&(l="");var r=document.createElement("script");r.setAttribute("recaptcha-v3-script","");var s="https://www.google.com/recaptcha/api.js";n&&(s=a?"https://recaptcha.net/recaptcha/enterprise.js":"https://recaptcha.net/recaptcha/api.js"),a&&(s="https://www.google.com/recaptcha/enterprise.js"),l&&(s=l),o.render&&(o.render=void 0);var c=this.buildQueryString(o);return r.src=s+"?render=explicit"+c,new Promise((function(t,n){r.addEventListener("load",i.waitForScriptToLoad((function(){t(r)}),a),!1),r.onerror=function(t){e.setLoadingState(Oe.NOT_LOADED),n(t)},document.head.appendChild(r)}))},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 a=this;return function(){void 0===window.grecaptcha?setTimeout((function(){a.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,a){var o={sitekey:t,badge:n.badge,size:n.size,tabindex:n.tabindex};return n.container?a?e.enterprise.render(n.container,o):e.render(n.container,o):a?e.enterprise.render(o):e.render(o)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();Me.load=De.load,Me.getInstance=De.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Me;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=ze;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(Ue);const Ve={};let Ne=null;const Be=()=>Ne??(Ne=A("WALINE_VOTE",[]));let We=null;const Fe=()=>We??(We=A("WALINE_USER",{}));var Ge=t({setup(){const t=n([]),r=Be(),s=a("config"),c=e((()=>s.value.locale)),u=e((()=>{const{reaction:e,path:n}=s.value;return e.map(((e,a)=>({icon:e,vote:t.value[a]||0,desc:c.value[`reaction${a}`],active:Boolean(r.value.find((({id:e,i:t})=>e===n&&t===a)))})))}));let d;return o((()=>{l((()=>[s.value.serverURL,s.value.path]),(()=>{(()=>{const{serverURL:e,lang:n,path:a,reaction:o}=s.value;if(o.length){const l=new AbortController;oe({serverURL:e,lang:n,paths:[a],type:o.map(((e,t)=>`reaction${t}`)),signal:l.signal}).then((e=>{Array.isArray(e)||"number"==typeof e||(t.value=o.map(((t,n)=>e[`reaction${n}`])))})),d=l.abort.bind(l)}})()}),{immediate:!0})})),i((()=>d?.())),{reaction:u,locale:c,vote:async e=>{const{serverURL:n,lang:a,path:o}=s.value,l=r.value.find((({id:e})=>e===o));l&&l.i===e||(await le({serverURL:n,lang:a,path:o,type:`reaction${e}`}),t.value[e]=(t.value[e]||0)+1,l?(t.value[l.i]=Math.max(t.value[l.i]-1,0),le({serverURL:n,lang:a,path:o,type:`reaction${l.i}`,action:"desc"}),l.i=e,r.value=Array.from(r.value)):r.value=[...r.value,{id:o,i:e}],r.value.length>50&&(r.value=r.value.slice(-50)))}}}}),Ke=(e,t)=>{const n=e.__vccOpts||e;for(const[e,a]of t)n[e]=a;return n};const qe={key:0,class:"wl-reaction"},Ze=["textContent"],Je=["onClick"],Ye={class:"wl-reaction-img"},Xe=["src","alt"],Qe={class:"wl-reaction-votes"},et={class:"wl-reaction-text"};var tt=Ke(Ge,[["render",function(e,t,n,a,o,l){return e.reaction.length?(r(),s("div",qe,[c("h4",{textContent:u(e.locale.reactionTitle)},null,8,Ze),c("ul",null,[(r(!0),s(d,null,m(e.reaction,((t,n)=>(r(),s("li",{key:n,class:p({active:t.active}),onClick:t=>e.vote(n)},[c("div",Ye,[c("img",{src:t.icon,alt:t.desc},null,8,Xe),c("div",Qe,u(t.vote),1)]),c("div",et,u(t.desc),1)],10,Je)))),128))])])):g("v-if",!0)}],["__file","ArticleReaction.vue"]]);const nt=({size:e})=>v("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},v("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},v("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var at=t({name:"ImageWall",components:{LoadingIcon:nt},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emits:["insert"],setup(e){let t=null;const a=n(null),i=n({}),r=n([]),s=()=>{const t=Math.floor((a.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},c=async t=>{if(t>=e.items.length)return;await f();const n=Array.from(a.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));r.value[Number(n.dataset.index)].push(t),await c(t+1)},u=async(e=!1)=>{if(r.value.length===s()&&!e)return;var t;r.value=(t=s(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await c(0),window.scrollTo({top:n})};return o((()=>{u(!0),t=new ResizeObserver((()=>u())),t.observe(a.value),l((()=>[e.items]),(()=>{i.value={},u(!0)})),l((()=>[e.columnWidth,e.gap]),(()=>u()))})),h((()=>t.unobserve(a.value))),{columns:r,state:i,wall:a,imageLoad:e=>{i.value[e.target.src]=!0}}}});const ot=["data-index"],lt=["src","title","onClick"];var it=t({name:"CommentBox",components:{CloseIcon:({size:e})=>v("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[v("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"}),v("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:()=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},v("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:()=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[v("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"}),v("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:Ke(at,[["render",function(e,t,n,a,o,l){const i=w("LoadingIcon");return r(),s("div",{ref:"wall",class:"wl-gallery",style:y({gap:`${e.gap}px`})},[(r(!0),s(d,null,m(e.columns,((n,a)=>(r(),s("div",{key:a,class:"wl-gallery-column","data-index":a,style:y({gap:`${e.gap}px`})},[(r(!0),s(d,null,m(n,(n=>(r(),s(d,{key:n},[e.state[e.items[n].src]?g("v-if",!0):(r(),b(i,{key:0,size:36,style:{margin:"20px auto"}})),c("img",{class:"wl-gallery-item",src:e.items[n].src,title:e.items[n].title,loading:"lazy",onLoad:t[0]||(t[0]=(...t)=>e.imageLoad&&e.imageLoad(...t)),onClick:t=>e.$emit("insert",``)},null,40,lt)],64)))),128))],12,ot)))),128))],4)}],["__file","ImageWall.vue"]]),MarkdownIcon:()=>v("svg",{width:"16",height:"16",ariaHidden:"true"},v("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:()=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[v("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"}),v("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:nt,GifIcon:()=>v("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[v("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"}),v("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(t,{emit:r}){const s=a("config"),c=A("WALINE_COMMENT_BOX_EDITOR",""),u=A("WALINE_USER_META",{nick:"",mail:"",link:""}),d=Fe(),m=n({}),p=n(null),g=n(null),v=n(null),h=n(null),f=n(null),w=n(null),y=n(null),b=n({tabs:[],map:{}}),C=n(0),L=n(!1),$=n(!1),I=n(!1),R=n(""),S=n(0),j=k({loading:!0,list:[]}),E=n(0),x=n(!1),U=n(""),z=n(!1),_=e((()=>s.value.locale)),T=e((()=>Boolean(d.value?.token))),O=e((()=>!1!==s.value.imageUploader)),H=e=>{const t=p.value,n=t.selectionStart,a=t.selectionEnd||0,o=t.scrollTop;c.value=t.value.substring(0,n)+e+t.value.substring(a,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=o},D=e=>{const t=`![${s.value.locale.uploading} ${e.name}]()`;return H(t),Promise.resolve().then((()=>s.value.imageUploader(e))).then((n=>{c.value=c.value.replace(t,`\r\n`)})).catch((e=>{alert(e.message),c.value=c.value.replace(t,"")}))},V=async()=>{const{serverURL:e,lang:n,login:a,wordLimit:o,requiredMeta:l}=s.value;let i="";s.value.recaptchaV3Key&&(i=await(e=>{const t=Ve[e]??(Ve[e]=Ue.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:e=>t.then((t=>t.execute(e)))}})(s.value.recaptchaV3Key).execute("social"));const g={comment:U.value,nick:u.value.nick,mail:u.value.mail,link:u.value.link,ua:navigator.userAgent,url:s.value.path,recaptchaV3:i};if(d.value?.token)g.nick=d.value.display_name,g.mail=d.value.email,g.link=d.value.url;else{if("force"===a)return;if(l.indexOf("nick")>-1&&!g.nick)return m.value.nick?.focus(),alert(_.value.nickError);if(l.indexOf("mail")>-1&&!g.mail||g.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(g.mail))return m.value.mail?.focus(),alert(_.value.mailError);if(!g.comment)return void p.value?.focus();g.nick||(g.nick=_.value.anonymous)}if(!x.value)return alert(_.value.wordHint.replace("$0",o[0].toString()).replace("$1",o[1].toString()).replace("$2",S.value.toString()));g.comment=Ie(g.comment,b.value.map),t.replyId&&t.rootId&&(g.pid=t.replyId,g.rid=t.rootId,g.at=t.replyUser),z.value=!0;const v={serverURL:e,lang:n,token:d.value?.token,comment:g};(t.edit?ie({objectId:t.edit.objectId,...v}):(({serverURL:e,lang:t,token:n,comment:a})=>{const o={"Content-Type":"application/json"};return n&&(o.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:o,body:JSON.stringify(a)}).then((e=>e.json()))})(v)).then((e=>{if(z.value=!1,e.errmsg)return alert(e.errmsg);r("submit",e.data),c.value="",R.value="",t.replyId&&r("cancel-reply"),t.edit?.objectId&&r("cancel-edit")})).catch((e=>{z.value=!1,alert(e.message)}))},N=e=>{v.value.contains(e.target)||h.value.contains(e.target)||(L.value=!1),f.value.contains(e.target)||w.value.contains(e.target)||($.value=!1)},B=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:a}=e.target,o=(n+t)/a,l=s.value.search,i=y.value?.value||"";o<.9||j.loading||(j.loading=!0,j.list=[...j.list,...l.more&&j.list.length?await l.more(i,j.list.length):await l.search(i)],j.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},W=M((e=>{j.list=[],B(e)}),300);l([s,S],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(E.value=n[0],x.value=!1):t>n[1]?(E.value=n[1],x.value=!1):(E.value=n[1],x.value=!0):(E.value=0,x.value=!0)}),{immediate:!0});const F=({data:e})=>{e&&"profile"===e.type&&(d.value={...d.value,...e.data},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(d)))))};return o((()=>{document.body.addEventListener("click",N),window.addEventListener("message",F),t.edit?.objectId&&(c.value=t.edit.orig),l($,(async e=>{if(!e)return;const t=s.value.search;y.value&&(y.value.value=""),j.loading=!0,j.list=t.default?await t.default():await t.search(""),j.loading=!1})),l((()=>c.value),(e=>{const{highlighter:t,texRenderer:n}=s.value;U.value=e,R.value=Re(e,{emojiMap:b.value.map,highlighter:t,texRenderer:n}),S.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?P(p.value):P.destroy(p.value)}),{immediate:!0}),l((()=>s.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?he(se(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:a,icon:o,prefix:l,type:i,items:r}=e;t.tabs.push({name:n,icon:fe(o,a,l,i),items:r.map((e=>{const n=`${l||""}${e}`;return t.map[n]=fe(e,a,l,i),n}))})})),t}))).then((e=>{b.value=e}));var t}),{immediate:!0})})),i((()=>{document.body.removeEventListener("click",N),window.removeEventListener("message",F)})),{config:s,locale:_,insert:H,onChange:()=>{const e=g.value;e.files&&O.value&&D(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=ke(e.dataTransfer.items);t&&O.value&&(D(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&V()},onPaste:e=>{if(e.clipboardData){const t=ke(e.clipboardData.items);t&&O.value&&D(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=s.value;(({lang:e,serverURL:t})=>{const n=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,o=window.open(`${t}/ui/login?lng=${encodeURIComponent(e)}`,"_blank",`width=450,height=450,left=${n},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);return o?.postMessage({type:"TOKEN",data:null},"*"),new Promise((e=>{const t=({data:n})=>{n&&"object"==typeof n&&"userInfo"===n.type&&n.data.token&&(o?.close(),window.removeEventListener("message",t),e(n.data))};window.addEventListener("message",t)}))})({serverURL:n,lang:t}).then((e=>{d.value=e,(e.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e))}))},onLogout:()=>{d.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=s.value,a=(window.innerWidth-800)/2,o=(window.innerHeight-800)/2,l=new URLSearchParams({lng:t,token:d.value.token});window.open(`${n}/ui/profile?${l.toString()}`,"_blank",`width=800,height=800,left=${a},top=${o},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:d.value.token},"*")},submitComment:V,onImageWallScroll:B,onGifSearch:W,isLogin:T,userInfo:d,isSubmitting:z,wordNumber:S,wordLimit:E,isWordNumberLegal:x,editor:c,userMeta:u,emoji:b,emojiTabIndex:C,showEmoji:L,gifData:j,showGif:$,canUploadImage:O,previewText:R,showPreview:I,inputRefs:m,editorRef:p,emojiButtonRef:v,emojiPopupRef:h,gifButtonRef:f,gifPopupRef:w,imageUploadRef:g,gifSearchInputRef:y}}});const rt={class:"wl-comment"},st={key:0,class:"wl-login-info"},ct={class:"wl-avatar"},ut=["title"],dt=["title"],mt=["src"],pt=["title","textContent"],gt={class:"wl-panel"},vt=["for","textContent"],ht=["id","onUpdate:modelValue","name","type"],ft=["placeholder"],wt={class:"wl-preview"},yt=c("hr",null,null,-1),bt=["innerHTML"],kt={class:"wl-footer"},Ct={class:"wl-actions"},Lt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},$t=["title"],It=["title"],Rt=["title"],St=["title"],jt={class:"wl-info"},Et={class:"wl-text-number"},xt={key:0},At=["textContent"],Ut=["textContent"],Mt=["disabled"],zt=["placeholder"],Pt={key:0,class:"wl-loading"},_t={key:0,class:"wl-tab-wrapper"},Tt=["title","onClick"],Ot=["src","alt"],Ht={key:0,class:"wl-tabs"},Dt=["onClick"],Vt=["src","alt","title"],Nt=["title"];var Bt=Ke(it,[["render",function(e,t,n,a,o,l){const i=w("CloseIcon"),v=w("MarkdownIcon"),h=w("EmojiIcon"),f=w("GifIcon"),y=w("ImageIcon"),k=w("PreviewIcon"),j=w("LoadingIcon"),E=w("ImageWall");return r(),s("div",rt,["disable"!==e.config.login&&e.isLogin&&!e.edit?.objectId?(r(),s("div",st,[c("div",ct,[c("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[C(i,{size:14})],8,ut),c("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t))},[c("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,mt)],8,dt)]),c("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:t[2]||(t[2]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:u(e.userInfo.display_name)},null,8,pt)])):g("v-if",!0),c("div",gt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(r(),s("div",{key:0,class:p(["wl-header",`item${e.config.meta.length}`])},[(r(!0),s(d,null,m(e.config.meta,(t=>(r(),s("div",{key:t,class:"wl-header-item"},[c("label",{for:`wl-${t}`,textContent:u(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,vt),L(c("input",{id:`wl-${t}`,ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},"onUpdate:modelValue":n=>e.userMeta[t]=n,class:p(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text"},null,10,ht),[[$,e.userMeta[t]]])])))),128))],2)):g("v-if",!0),L(c("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":t[3]||(t[3]=t=>e.editor=t),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,onKeydown:t[4]||(t[4]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[5]||(t[5]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[6]||(t[6]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,ft),[[I,e.editor]]),L(c("div",wt,[yt,c("h4",null,u(e.locale.preview)+":",1),g(" eslint-disable-next-line vue/no-v-html "),c("div",{class:"wl-content",innerHTML:e.previewText},null,8,bt)],512),[[R,e.showPreview]]),c("div",kt,[c("div",Ct,[c("a",Lt,[C(v)]),L(c("button",{ref:"emojiButtonRef",class:p(["wl-action",{active:e.showEmoji}]),title:e.locale.emoji,onClick:t[7]||(t[7]=t=>e.showEmoji=!e.showEmoji)},[C(h)],10,$t),[[R,e.emoji.tabs.length]]),e.config.search?(r(),s("button",{key:0,ref:"gifButtonRef",class:p(["wl-action",{active:e.showGif}]),title:e.locale.gif,onClick:t[8]||(t[8]=t=>e.showGif=!e.showGif)},[C(f)],10,It)):g("v-if",!0),c("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[9]||(t[9]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(r(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[C(y)],8,Rt)):g("v-if",!0),c("button",{class:p(["wl-action",{active:e.showPreview}]),title:e.locale.preview,onClick:t[10]||(t[10]=t=>e.showPreview=!e.showPreview)},[C(k)],10,St)]),c("div",jt,[c("div",Et,[S(u(e.wordNumber)+" ",1),e.config.wordLimit?(r(),s("span",xt,[S(" / "),c("span",{class:p({illegal:!e.isWordNumberLegal}),textContent:u(e.wordLimit)},null,10,At)])):g("v-if",!0),S(" "+u(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?g("v-if",!0):(r(),s("button",{key:0,class:"wl-btn",onClick:t[11]||(t[11]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:u(e.locale.login)},null,8,Ut)),"force"!==e.config.login||e.isLogin?(r(),s("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[12]||(t[12]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(r(),b(j,{key:0,size:16})):(r(),s(d,{key:1},[S(u(e.locale.submit),1)],64))],8,Mt)):g("v-if",!0)]),c("div",{ref:"gifPopupRef",class:p(["wl-gif-popup",{display:e.showGif}])},[c("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:t[13]||(t[13]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,zt),C(E,{items:e.gifData.list,"column-width":200,gap:6,onInsert:t[14]||(t[14]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(r(),s("div",Pt,[C(j,{size:30})])):g("v-if",!0)],2),c("div",{ref:"emojiPopupRef",class:p(["wl-emoji-popup",{display:e.showEmoji}])},[(r(!0),s(d,null,m(e.emoji.tabs,((t,n)=>(r(),s(d,{key:t.name},[n===e.emojiTabIndex?(r(),s("div",_t,[(r(!0),s(d,null,m(t.items,(t=>(r(),s("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(r(),s("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ot)):g("v-if",!0)],8,Tt)))),128))])):g("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(r(),s("div",Ht,[(r(!0),s(d,null,m(e.emoji.tabs,((t,n)=>(r(),s("button",{key:t.name,class:p(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[c("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Vt)],10,Dt)))),128))])):g("v-if",!0)],2)])]),e.replyId||e.edit?.objectId?(r(),s("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[15]||(t[15]=t=>e.$emit(e.replyId?"cancel-reply":"cancel-edit"))},[C(i,{size:24})],8,Nt)):g("v-if",!0)])}],["__file","CommentBox.vue"]]);const Wt=["approved","waiting","spam"];var Ft=t({components:{CommentBox:Bt,DeleteIcon:()=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},v("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})=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[v("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:()=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},v("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:()=>v("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},v("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:()=>v("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},v("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(t){const n=a("config"),o=xe(),l=Fe(),i=e((()=>n.value.locale)),r=e((()=>{const{link:e}=t.comment;return e?ce(e)?e:`https://${e}`:""})),s=e((()=>o.value.includes(t.comment.objectId))),c=((t,n)=>{const a=U();return e((()=>ve(t,a.value,n)))})(t.comment.insertedAt,i.value),u=e((()=>"administrator"===l.value.type)),d=e((()=>t.comment.user_id&&l.value.objectId===t.comment.user_id)),m=e((()=>t.comment.objectId===t.reply?.objectId)),p=e((()=>t.comment.objectId===t.edit?.objectId));return{config:n,locale:i,isReplyingCurrent:m,isEditingCurrent:p,link:r,like:s,time:c,isAdmin:u,isOwner:d,commentStatus:Wt}}});const Gt=["id"],Kt={class:"wl-user","aria-hidden":"true"},qt=["src"],Zt={class:"wl-card"},Jt={class:"wl-head"},Yt=["href"],Xt={key:1,class:"wl-nick"},Qt=["textContent"],en=["textContent"],tn=["textContent"],nn=["textContent"],an=["textContent"],on={class:"wl-comment-actions"},ln=["title"],rn=["textContent"],sn=["title"],cn={class:"wl-meta","aria-hidden":"true"},un=["data-value","textContent"],dn=["data-value","textContent"],mn=["data-value","textContent"],pn=["innerHTML"],gn={key:1,class:"wl-admin-actions"},vn={class:"wl-comment-status"},hn=["disabled","onClick","textContent"],fn={key:3,class:"wl-quote"};var wn=Ke(Ft,[["render",function(e,t,n,a,o,l){const i=w("VerifiedIcon"),v=w("EditIcon"),h=w("DeleteIcon"),f=w("LikeIcon"),y=w("ReplyIcon"),k=w("CommentBox"),L=w("CommentCard",!0);return r(),s("div",{id:e.comment.objectId,class:"wl-item"},[c("div",Kt,[e.comment.avatar?(r(),s("img",{key:0,src:e.comment.avatar},null,8,qt)):g("v-if",!0),e.comment.type?(r(),b(i,{key:1})):g("v-if",!0)]),c("div",Zt,[c("div",Jt,[e.link?(r(),s("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},u(e.comment.nick),9,Yt)):(r(),s("span",Xt,u(e.comment.nick),1)),"administrator"===e.comment.type?(r(),s("span",{key:2,class:"wl-badge",textContent:u(e.locale.admin)},null,8,Qt)):g("v-if",!0),e.comment.label?(r(),s("span",{key:3,class:"wl-badge",textContent:u(e.comment.label)},null,8,en)):g("v-if",!0),e.comment.sticky?(r(),s("span",{key:4,class:"wl-badge",textContent:u(e.locale.sticky)},null,8,tn)):g("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(r(),s("span",{key:5,class:p(`wl-badge level${e.comment.level}`),textContent:u(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,nn)):g("v-if",!0),c("span",{class:"wl-time",textContent:u(e.time)},null,8,an),c("div",on,[e.isAdmin||e.isOwner?(r(),s("button",{key:0,class:"wl-edit",onClick:t[0]||(t[0]=t=>e.$emit("edit",e.comment))},[C(v)])):g("v-if",!0),e.isAdmin||e.isOwner?(r(),s("button",{key:1,class:"wl-delete",onClick:t[1]||(t[1]=t=>e.$emit("delete",e.comment))},[C(h)])):g("v-if",!0),c("button",{class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:t[2]||(t[2]=t=>e.$emit("like",e.comment))},[C(f,{active:e.like},null,8,["active"]),"like"in e.comment?(r(),s("span",{key:0,textContent:u(e.comment.like)},null,8,rn)):g("v-if",!0)],8,ln),c("button",{class:p(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[3]||(t[3]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[C(y)],10,sn)])]),c("div",cn,[e.comment.addr?(r(),s("span",{key:0,class:"wl-addr","data-value":e.comment.addr,textContent:u(e.comment.addr)},null,8,un)):g("v-if",!0),e.comment.browser?(r(),s("span",{key:1,class:"wl-browser","data-value":e.comment.browser,textContent:u(e.comment.browser)},null,8,dn)):g("v-if",!0),e.comment.os?(r(),s("span",{key:2,class:"wl-os","data-value":e.comment.os,textContent:u(e.comment.os)},null,8,mn)):g("v-if",!0)]),g(" eslint-disable vue/no-v-html "),e.isEditingCurrent?g("v-if",!0):(r(),s("div",{key:0,class:"wl-content",innerHTML:e.comment.comment},null,8,pn)),g(" eslint-enable vue/no-v-html "),e.isAdmin&&!e.isEditingCurrent?(r(),s("div",gn,[c("span",vn,[(r(!0),s(d,null,m(e.commentStatus,(t=>(r(),s("button",{key:t,class:p(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:u(e.locale[t])},null,10,hn)))),128))]),e.isAdmin&&!e.comment.rid?(r(),s("button",{key:0,class:"wl-btn wl-sticky",onClick:t[4]||(t[4]=t=>e.$emit("sticky",e.comment))},u(e.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):g("v-if",!0)])):g("v-if",!0),e.isReplyingCurrent||e.isEditingCurrent?(r(),s("div",{key:2,class:p({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[C(k,{edit:e.edit,"reply-id":e.reply?.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onSubmit:t[5]||(t[5]=t=>e.$emit("submit",t)),onCancelReply:t[6]||(t[6]=t=>e.$emit("reply",null)),onCancelEdit:t[7]||(t[7]=t=>e.$emit("edit",null))},null,8,["edit","reply-id","reply-user","root-id"])],2)):g("v-if",!0),e.comment.children?(r(),s("div",fn,[(r(!0),s(d,null,m(e.comment.children,(n=>(r(),b(L,{key:n.objectId,comment:n,reply:e.reply,edit:e.edit,"root-id":e.rootId,onReply:t[8]||(t[8]=t=>e.$emit("reply",t)),onSubmit:t[9]||(t[9]=t=>e.$emit("submit",t)),onLike:t[10]||(t[10]=t=>e.$emit("like",t)),onEdit:t[11]||(t[11]=t=>e.$emit("edit",t)),onDelete:t[12]||(t[12]=t=>e.$emit("delete",t)),onStatus:t[13]||(t[13]=t=>e.$emit("status",t)),onSticky:t[14]||(t[14]=t=>e.$emit("sticky",t))},null,8,["comment","reply","edit","root-id"])))),128))])):g("v-if",!0)])],8,Gt)}],["__file","CommentCard.vue"]]);const yn={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},bn=Object.keys(yn);var kn=t({name:"WalineRoot",components:{Reaction:tt,CommentBox:Bt,CommentCard:wn,LoadingIcon:nt},props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","reaction"],setup(t){const a=t,r=e((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:a,emoji:o=["//unpkg.com/@waline/emojis@1.1.0/weibo"],meta:l=["nick","mail","link"],requiredMeta:i=[],dark:r=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:d,texRenderer:m,copyright:p=!0,login:g="enable",search:v,reaction:h,recaptchaV3Key:f="",commentSorting:w="latest",...y})=>({serverURL:ue(e),path:re(t),locale:{...te[n]||te["zh-CN"],..."object"==typeof a?a:{}},wordLimit:de(c),meta:O(l),requiredMeta:O(i),imageUploader:me(u,H),highlighter:me(d,G),texRenderer:me(m,D),lang:n,dark:r,emoji:o,pageSize:s,login:g,copyright:p,search:v??V(n),recaptchaV3Key:f,reaction:Array.isArray(h)?h:!0===h?N:[],commentSorting:w,...y}))(a))),s=Fe(),c=xe(),u=n("loading"),d=n(0),m=n(1),p=n(0),g=n(r.value.commentSorting),v=n([]),h=n(null),f=n(null),w=e((()=>{return"string"==typeof(e=r.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${pe}}`:`${e}${pe}`:!0===e?`:root${pe}`:"";var e}));let y;z(w);const b=e=>{const{serverURL:t,path:n,pageSize:a}=r.value,o=new AbortController;u.value="loading",y?.(),(({serverURL:e,lang:t,path:n,page:a,pageSize:o,sortBy:l,signal:i,token:r})=>{const s={};return r&&(s.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${a}&lang=${t}&sortBy=${l}`,{signal:i,headers:s}).then((e=>e.json())).then((e=>ae(e,"Get comment data")))})({serverURL:t,lang:r.value.lang,path:n,pageSize:a,sortBy:yn[g.value],page:e,signal:o.signal,token:s.value?.token}).then((t=>{u.value="success",d.value=t.count,v.value.push(...t.data),m.value=e,p.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),u.value="error")})),y=o.abort.bind(o)},k=()=>{d.value=0,v.value=[],b(1)};return j("config",r),o((()=>{l((()=>[a.serverURL,a.path]),(()=>k()),{immediate:!0})})),i((()=>y?.())),{config:r,darkmodeStyle:w,i18n:e((()=>r.value.locale)),status:u,count:d,page:m,totalPages:p,commentSorting:g,sortingMethods:bn,data:v,reply:h,edit:f,loadMore:()=>b(m.value+1),refresh:k,onSortByChange:e=>{g.value!==e&&(g.value=e,k())},onReply:e=>{h.value=e},onSubmit:e=>{if(f.value)f.value.comment=e.comment,f.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:a}=r.value;await ie({serverURL:n,lang:a,token:s.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}=r.value;await(({serverURL:e,lang:t,token:n,objectId:a})=>fetch(`${e}/comment/${a}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())).then((e=>ae(e,"Delete comment"))))({serverURL:t,lang:n,token:s.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(((a,o)=>a.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==o)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:n}=r.value;await ie({serverURL:t,lang:n,token:s.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:n}=r.value,{objectId:a}=e,o=c.value.includes(a);await ie({serverURL:t,lang:n,objectId:a,token:s.value?.token,like:!o}),o?c.value=c.value.filter((e=>e!==a)):(c.value=[...c.value,a],c.value.length>50&&(c.value=c.value.slice(-50))),e.like=(e.like||0)+(o?-1:1)},onEdit:e=>{f.value=e},version:"2.14.1"}}});const Cn={"data-waline":""},Ln={class:"wl-meta-head"},$n={class:"wl-count"},In=["textContent"],Rn={class:"wl-sort"},Sn=["onClick"],jn={class:"wl-cards"},En={key:1,class:"wl-operation"},xn=["textContent"],An={key:0,class:"wl-loading"},Un=["textContent"],Mn={class:"wl-operation"},zn=["textContent"],Pn={key:3,class:"wl-power"},_n=c("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Tn=Ke(kn,[["render",function(e,t,n,a,o,l){const i=w("Reaction"),v=w("CommentBox"),h=w("CommentCard"),f=w("LoadingIcon");return r(),s("div",Cn,[C(i),e.reply?g("v-if",!0):(r(),b(v,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),c("div",Ln,[c("div",$n,[e.count?(r(),s("span",{key:0,class:"wl-num",textContent:u(e.count)},null,8,In)):g("v-if",!0),S(" "+u(e.i18n.comment),1)]),c("ul",Rn,[(r(!0),s(d,null,m(e.sortingMethods,(t=>(r(),s("li",{key:t,class:p([t===e.commentSorting?"active":""]),onClick:n=>e.onSortByChange(t)},u(e.i18n[t]),11,Sn)))),128))])]),c("div",jn,[(r(!0),s(d,null,m(e.data,(t=>(r(),b(h,{key:t.objectId,"root-id":t.objectId,comment:t,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?(r(),s("div",En,[c("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:u(e.i18n.refresh)},null,8,xn)])):(r(),s(d,{key:2},["loading"===e.status?(r(),s("div",An,[C(f,{size:30})])):e.data.length?e.page<e.totalPages?(r(),s(d,{key:2},[g(" Load more button "),c("div",Mn,[c("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:u(e.i18n.more)},null,8,zn)])],2112)):g("v-if",!0):(r(),s("div",{key:1,class:"wl-empty",textContent:u(e.i18n.sofa)},null,8,Un))],64)),g(" Copyright Information "),e.config.copyright?(r(),s("div",Pn,[S(" Powered by "),_n,S(" v"+u(e.version),1)])):g("v-if",!0)])}],["__file","Waline.vue"]]);const On=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Hn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:a=!0,lang:o="zh-CN"})=>{const l=new AbortController,i=Array.from(document.querySelectorAll(n)),r=e=>{const n=Se(e);return null!==n&&t!==n},s=n=>(({serverURL:e,lang:t,paths:n,signal:a})=>oe({serverURL:e,lang:t,paths:n,type:["time"],signal:a}).then((e=>Array.isArray(e)?e:[e])))({serverURL:ue(e),paths:n.map((e=>Se(e)||t)),lang:o,signal:l.signal}).then((e=>On(e,n))).catch(we);if(a){const n=i.filter((e=>!r(e))),a=i.filter(r);(c={serverURL:ue(e),path:t,lang:o},le({...c,type:"time",action:"inc"})).then((e=>On(new Array(n.length).fill(e),n))),a.length&&s(a)}else s(i);var c;return l.abort.bind(l)},Dn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:a=!1,...o})=>{const l=e?ye(e):null;if(e&&!l)throw new Error("Option 'el' do not match any domElement!");if(!o.serverURL)throw new Error("Option 'serverURL' is missing!");const i=k({...o}),r=k({comment:n,pageview:a,path:t}),s=l?E((()=>v(Tn,{path:r.path,...i}))):null;s&&s.mount(l);const c=x((()=>{r.comment&&je({serverURL:i.serverURL,path:r.path,selector:"string"==typeof r.comment?r.comment:void 0})})),u=x((()=>{r.pageview&&Hn({serverURL:i.serverURL,path:r.path,selector:"string"==typeof r.pageview?r.pageview:void 0})}));return{el:l,update:({comment:e,pageview:t,path:n=window.location.pathname,...a}={})=>{Object.entries(a).forEach((([e,t])=>{i[e]=t})),r.path=n,void 0!==e&&(r.comment=e),void 0!==t&&(r.pageview=t)},destroy:()=>{s?.unmount(),c(),u()}}},Vn="2.14.1",Nn=({el:e,serverURL:t,count:n,lang:a="zh-CN"})=>{const o=Fe(),l=ye(e),i=new AbortController;return(({serverURL:e,lang:t,count:n,signal:a,token:o})=>{const l={};return o&&(l.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:a,headers:l}).then((e=>e.json()))})({serverURL:t,count:n,lang:a,signal:i.signal,token:o.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:()=>{i.abort(),l.innerHTML=""}}):{comments:e,destroy:()=>i.abort()}))},Bn=({el:e,serverURL:t,count:n,locale:a,lang:o="zh-CN",mode:l="list"})=>{const i=ye(e),r=new AbortController;return(({serverURL:e,signal:t,pageSize:n,lang:a})=>fetch(`${e}/user?pageSize=${n}&lang=${a}`,{signal:t}).then((e=>e.json())).then((e=>ae(e,"user list"))).then((e=>e.data)))({serverURL:t,pageSize:n,lang:o,signal:r.signal}).then((e=>i&&e.length?(a={...te[o]||te["zh-CN"],..."object"==typeof a?a:{}},i.innerHTML=`<ul class="wl-user-${l}">${e.map(((e,t)=>[`<li class="wl-user-item" aria-label="${e.nick}">`,e.link&&`<a href="${e.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${e.avatar}" alt="${e.nick}">`,`<span class="wl-user-badge">${t+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',e.nick,e.level&&`<span class="wl-badge">${a?a[`level${e.level}`]:`Level ${e.level}`}</span>`,e.label&&`<span class="wl-badge">${e.label}</span>`,"</div>",e.link&&e.link,"</div>",e.link&&"</a>","</li>"].filter((e=>e)).join(""))).join("")}</ul>`,{users:e,destroy:()=>{r.abort(),i.innerHTML=""}}):{users:e,destroy:()=>r.abort()}))};export{Nn as RecentComments,Bn as UserList,je as commentCount,te as defaultLocales,Dn as init,Hn as pageviewCount,Vn as version};
|
|
1
|
+
import{h as e,defineComponent as t,inject as n,ref as a,computed as l,onMounted as o,watch as r,onUnmounted as i,unref as s,openBlock as c,createElementBlock as u,createElementVNode as d,toDisplayString as m,Fragment as v,renderList as p,normalizeClass as g,createBlock as h,createCommentVNode as f,onBeforeUnmount as y,normalizeStyle as w,nextTick as b,reactive as k,createVNode as C,withDirectives as $,vModelDynamic as L,isRef as R,vModelText as x,vShow as E,createTextVNode as I,resolveComponent as j,provide as S,createApp as A,watchEffect as U}from"vue";import{useStorage as _,useDebounceFn as z,useNow as M,useStyleTag as H}from"@vueuse/core";import T from"autosize";import{marked as O}from"marked";const P=["nick","mail","link"],V=e=>e.filter((e=>P.includes(e))),B=["//unpkg.com/@waline/emojis@1.1.0/weibo"],D="en-US",N=e=>new Promise(((t,n)=>{if(e.size>128e3)return n(new Error("File too large! File size limit 128KB"));const a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result?.toString()||""),a.onerror=n})),F=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>',W=e=>{const t=async(t,n={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...n}).toString()}`).then((e=>e.json())).then((({data:e})=>e.map((e=>({title:e.title,src:e.images.downsized_medium.url})))));return{search:e=>t("search",{q:e,offset:"0"}),default:()=>t("trending",{}),more:(e,n=0)=>t("search",{q:e,offset:n.toString()})}},K=["//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"],q=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"),G=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Z={},J=e=>{let t=0;return e.replace(q,((e,n,a)=>{if(a)return`<span style="color: slategray">${a}</span>`;if("<"===n)return"<";let l;Z[n]?l=Z[n]:(l=G[t],Z[n]=l);const o=`<span style="color: #${l}">${n}</span>`;return t=++t%G.length,o}))},Y=["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"],X=e=>Object.fromEntries(e.map(((e,t)=>[Y[t],e])));var Q=X(["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?"]),ee=X(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),te=X(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),ne=X(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包","個人資料","通過","待審核","垃圾","取消置頂","按倒序","按正序","按熱度","你認為這篇文章怎麼樣?"]),ae=X(["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?"]),le=X(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]);const oe={zh:te,"zh-cn":te,"zh-CN":te,"zh-tw":ne,"zh-TW":ne,en:Q,"en-US":Q,"en-us":Q,jp:ee,ja:ee,"jp-jp":ee,"jp-JP":ee,"pt-br":ae,"pt-BR":ae,ru:le,"ru-ru":le,"ru-RU":le},re={"Content-Type":"application/json"},ie=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},se=({serverURL:e,lang:t,paths:n,type:a,signal:l})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:l}).then((e=>e.json())),ce=({serverURL:e,lang:t,path:n,type:a,action:l})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:re,body:JSON.stringify({path:n,type:a,action:l})}).then((e=>e.json())),ue=({serverURL:e,lang:t,token:n,objectId:a,comment:l})=>fetch(`${e}/comment/${a}?lang=${t}`,{method:"PUT",headers:{...re,Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())).then((e=>ie(e,"Update comment"))),de=e=>{try{e=decodeURI(e)}catch(e){}return e},me=(e="")=>e.replace(/\/$/u,""),ve=e=>/^(https?:)?\/\//.test(e),pe=e=>{const t=me(e);return ve(t)?t:`https://${t}`},ge=e=>Array.isArray(e)?e:!!e&&[0,e],he=(e,t)=>"function"==typeof e?e:!1!==e&&t,fe="{--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}",ye=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},we=(e,t,n)=>{if(!e)return"";const a="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-a.getTime(),o=Math.floor(l/864e5);if(0===o){const e=l%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,a=Math.floor(t/6e4);if(0===a){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${a} ${n.minutes}`}return`${t} ${n.hours}`}return o<0?n.now:o<8?`${o} ${n.days}`:(e=>{const t=ye(e.getDate(),2),n=ye(e.getMonth()+1,2);return`${ye(e.getFullYear(),2)}-${n}-${t}`})(a)},be=e=>{const t=_("WALINE_EMOJI",{}),n=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(e));if(n){const n=t.value[e];if(n)return Promise.resolve(n)}return fetch(`${e}/info.json`).then((e=>e.json())).then((a=>{const l={folder:e,...a};return n&&(t.value[e]=l),l}))},ke=(e,t="",n="",a="")=>`${t?`${t}/`:""}${n}${e}${a?`.${a}`:""}`,Ce=e=>{"AbortError"!==e.name&&console.error(e.message)},$e=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Le=e=>e.type.includes("image"),Re=e=>{const t=Array.from(e).find(Le);return t?t.getAsFile():null},xe=/\$.*?\$/,Ee=/^\$(.*?)\$/,Ie=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,je=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Se=(e,{emojiMap:t,highlighter:n,texRenderer:a})=>{if(O.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),a){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Ie.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(xe);return-1!==t?t:e.length},tokenizer(t){const n=Ee.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(a);O.use({extensions:e})}return O.parse(je(e,t))},Ae=e=>e.dataset.path||e.getAttribute("id"),Ue=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:a=navigator.language})=>{const l=new AbortController,o=document.querySelectorAll(n);return o.length&&(({serverURL:e,lang:t,paths:n,signal:a})=>fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:a}).then((e=>e.json())).then((e=>Array.isArray(e)?e:[e])))({serverURL:pe(e),paths:Array.from(o).map((e=>de(e.dataset.path||e.getAttribute("id")||t))),lang:a,signal:l.signal}).then((e=>{o.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(Ce),l.abort.bind(l)},_e=({size:t})=>e("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:t,height:t},[e("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"}),e("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"})]),ze=()=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e("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"})),Me=()=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e("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"})),He=()=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e("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"}),e("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"})]),Te=({active:t=!1})=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e("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"+(t?"":"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:t?"red":"currentColor"})]),Oe=()=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[e("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"}),e("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"})]),Pe=()=>e("svg",{width:"16",height:"16",ariaHidden:"true"},e("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"})),Ve=()=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e("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"})),Be=()=>e("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},e("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"})),De=()=>e("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},e("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"})),Ne=({size:t})=>e("svg",{width:t,height:t,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},e("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Fe=()=>e("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[e("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"}),e("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"})]);let We=null;const Ke=()=>We||(We=_("WALINE_LIKE",[]));let qe=null;const Ge=()=>qe??(qe=_("WALINE_REACTION",{}));var Ze="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Je={},Ye={},Xe={},Qe=Ze&&Ze.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(l,o){function r(e){try{s(a.next(e))}catch(e){o(e)}}function i(e){try{s(a.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,i)}s((a=a.apply(e,t||[])).next())}))},et=Ze&&Ze.__generator||function(e,t){var n,a,l,o,r={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,a&&(l=2&o[0]?a.return:o[0]?a.throw||((l=a.return)&&l.call(a),0):a.next)&&!(l=l.call(a,o[1])).done)return l;switch(a=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,a=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(l=r.trys,(l=l.length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){r.label=o[1];break}if(6===o[0]&&r.label<l[1]){r.label=l[1],l=o;break}if(l&&r.label<l[2]){r.label=l[2],r.ops.push(o);break}l[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],a=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}};Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.ReCaptchaInstance=void 0;var tt=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 Qe(this,void 0,void 0,(function(){return et(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}();Xe.ReCaptchaInstance=tt,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.getInstance=Ye.load=void 0;var nt,at=Xe;!function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(nt||(nt={}));var lt=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()===nt.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===nt.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(nt.LOADING);var a=new e;return new Promise((function(l,o){a.loadScript(t,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then((function(){e.setLoadingState(nt.LOADED);var o=a.doExplicitRender(grecaptcha,t,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),r=new at.ReCaptchaInstance(t,o,grecaptcha);e.successfulLoadingConsumers.forEach((function(e){return e(r)})),e.successfulLoadingConsumers=[],n.autoHideBadge&&r.hideBadge(),e.instance=r,l(r)})).catch((function(t){e.errorLoadingRunnable.forEach((function(e){return e(t)})),e.errorLoadingRunnable=[],o(t)}))}))},e.getInstance=function(){return e.instance},e.setLoadingState=function(t){e.loadingState=t},e.getLoadingState=function(){return null===e.loadingState?nt.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,n,a,l,o){var r=this;void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===l&&(l={}),void 0===o&&(o="");var i=document.createElement("script");i.setAttribute("recaptcha-v3-script","");var s="https://www.google.com/recaptcha/api.js";n&&(s=a?"https://recaptcha.net/recaptcha/enterprise.js":"https://recaptcha.net/recaptcha/api.js"),a&&(s="https://www.google.com/recaptcha/enterprise.js"),o&&(s=o),l.render&&(l.render=void 0);var c=this.buildQueryString(l);return i.src=s+"?render=explicit"+c,new Promise((function(t,n){i.addEventListener("load",r.waitForScriptToLoad((function(){t(i)}),a),!1),i.onerror=function(t){e.setLoadingState(nt.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 a=this;return function(){void 0===window.grecaptcha?setTimeout((function(){a.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,a){var l={sitekey:t,badge:n.badge,size:n.size,tabindex:n.tabindex};return n.container?a?e.enterprise.render(n.container,l):e.render(n.container,l):a?e.enterprise.render(l):e.render(l)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();Ye.load=lt.load,Ye.getInstance=lt.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Ye;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=Xe;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(Je);const ot={};let rt=null;const it=()=>rt??(rt=_("WALINE_USER",{})),st={key:0,class:"wl-reaction"},ct=["textContent"],ut={class:"wl-reaction-list"},dt=["onClick"],mt={class:"wl-reaction-img"},vt=["src","alt"],pt=["textContent"],gt=["textContent"];var ht=t({__name:"ArticleReaction",setup(e,{expose:t}){t();const y=Ge(),w=n("config"),b=a(-1),k=a([]),C=l((()=>w.value.locale)),$=l((()=>w.value.reaction.length>0)),L=l((()=>{const{reaction:e,path:t}=w.value;return e.map(((e,n)=>({icon:e,desc:C.value[`reaction${n}`],active:y.value[t]===n})))}));let R;return o((()=>{r((()=>[w.value.serverURL,w.value.path]),(()=>{(async()=>{if($.value){const{serverURL:e,lang:t,path:n,reaction:a}=w.value,l=new AbortController;R=l.abort.bind(l);const o=await se({serverURL:e,lang:t,paths:[n],type:a.map(((e,t)=>`reaction${t}`)),signal:l.signal});if(Array.isArray(o)||"number"==typeof o)return;k.value=a.map(((e,t)=>o[`reaction${t}`]))}})()}),{immediate:!0})})),i((()=>R?.())),(e,t)=>s(L).length?(c(),u("div",st,[d("h4",{textContent:m(s(C).reactionTitle)},null,8,ct),d("ul",ut,[(c(!0),u(v,null,p(s(L),(({active:e,icon:t,desc:n},a)=>(c(),u("li",{key:a,class:g(["wl-reaction-item",{active:e}]),onClick:e=>(async e=>{if(-1===b.value){const{serverURL:t,lang:n,path:a}=w.value,l=y.value[a];b.value=e,void 0!==l&&(await ce({serverURL:t,lang:n,path:a,type:`reaction${l}`,action:"desc"}),k.value[l]=Math.max(k.value[l]-1,0)),l!==e&&(await ce({serverURL:t,lang:n,path:a,type:`reaction${e}`}),k.value[e]=(k.value[e]||0)+1),l===e?delete y.value[a]:y.value[a]=e,b.value=-1}})(a)},[d("div",mt,[d("img",{src:t,alt:n},null,8,vt),b.value===a?(c(),h(s(Ne),{key:0,class:"wl-reaction-loading"})):(c(),u("div",{key:1,class:"wl-reaction-votes",textContent:m(k.value[a]||0)},null,8,pt))]),d("div",{class:"wl-reaction-text",textContent:m(n)},null,8,gt)],10,dt)))),128))])])):f("v-if",!0)}}),ft=(e,t)=>{const n=e.__vccOpts||e;for(const[e,a]of t)n[e]=a;return n},yt=ft(ht,[["__file","ArticleReaction.vue"]]);const wt=["data-index"],bt=["src","title","onClick"];var kt=ft(t({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:t}){const n=e;t();let l=null;const i=a(null),m=a({}),g=a([]),k=()=>{const e=Math.floor((i.value.getBoundingClientRect().width+n.gap)/(n.columnWidth+n.gap));return e>0?e:1},C=async e=>{if(e>=n.items.length)return;await b();const t=Array.from(i.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));g.value[Number(t.dataset.index)].push(e),await C(e+1)},$=async(e=!1)=>{if(g.value.length===k()&&!e)return;var t;g.value=(t=k(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await C(0),window.scrollTo({top:n})},L=e=>{m.value[e.target.src]=!0};return o((()=>{$(!0),l=new ResizeObserver((()=>{$()})),l.observe(i.value),r((()=>[n.items]),(()=>{m.value={},$(!0)})),r((()=>[n.columnWidth,n.gap]),(()=>{$()}))})),y((()=>l.unobserve(i.value))),(t,n)=>(c(),u("div",{ref_key:"wall",ref:i,class:"wl-gallery",style:w({gap:`${e.gap}px`})},[(c(!0),u(v,null,p(g.value,((n,a)=>(c(),u("div",{key:a,class:"wl-gallery-column","data-index":a,style:w({gap:`${e.gap}px`})},[(c(!0),u(v,null,p(n,(n=>(c(),u(v,{key:n},[m.value[e.items[n].src]?f("v-if",!0):(c(),h(s(Ne),{key:0,size:36,style:{margin:"20px auto"}})),d("img",{class:"wl-gallery-item",src:e.items[n].src,title:e.items[n].title,loading:"lazy",onLoad:L,onClick:a=>t.$emit("insert",``)},null,40,bt)],64)))),128))],12,wt)))),128))],4))}}),[["__file","ImageWall.vue"]]);const Ct={class:"wl-comment"},$t={key:0,class:"wl-login-info"},Lt={class:"wl-avatar"},Rt=["title"],xt=["title"],Et=["src"],It=["title","textContent"],jt={class:"wl-panel"},St=["for","textContent"],At=["id","onUpdate:modelValue","name","type"],Ut=["placeholder"],_t={class:"wl-preview"},zt=d("hr",null,null,-1),Mt=["innerHTML"],Ht={class:"wl-footer"},Tt={class:"wl-actions"},Ot={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Pt=["title"],Vt=["title"],Bt=["title"],Dt=["title"],Nt={class:"wl-info"},Ft={class:"wl-text-number"},Wt={key:0},Kt=["textContent"],qt=["textContent"],Gt=["disabled"],Zt=["placeholder"],Jt={key:0,class:"wl-loading"},Yt={key:0,class:"wl-tab-wrapper"},Xt=["title","onClick"],Qt=["src","alt"],en={key:0,class:"wl-tabs"},tn=["onClick"],nn=["src","alt","title"],an=["title"];var ln=t({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:t,emit:y}){const w=e;t();const b=n("config"),j=_("WALINE_COMMENT_BOX_EDITOR",""),S=_("WALINE_USER_META",{nick:"",mail:"",link:""}),A=it(),U=a({}),M=a(null),H=a(null),O=a(null),P=a(null),V=a(null),B=a(null),D=a(null),N=a({tabs:[],map:{}}),F=a(0),W=a(!1),K=a(!1),q=a(!1),G=a(""),Z=a(0),J=k({loading:!0,list:[]}),Y=a(0),X=a(!1),Q=a(""),ee=a(!1),te=l((()=>b.value.locale)),ne=l((()=>Boolean(A.value?.token))),ae=l((()=>!1!==b.value.imageUploader)),le=e=>{const t=M.value,n=t.selectionStart,a=t.selectionEnd||0,l=t.scrollTop;j.value=t.value.substring(0,n)+e+t.value.substring(a,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},oe=e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&de()},re=e=>{const t=`![${b.value.locale.uploading} ${e.name}]()`;return le(t),Promise.resolve().then((()=>b.value.imageUploader(e))).then((n=>{j.value=j.value.replace(t,`\r\n`)})).catch((e=>{alert(e.message),j.value=j.value.replace(t,"")}))},ie=e=>{if(e.dataTransfer?.items){const t=Re(e.dataTransfer.items);t&&ae.value&&(re(t),e.preventDefault())}},se=e=>{if(e.clipboardData){const t=Re(e.clipboardData.items);t&&ae.value&&re(t)}},ce=()=>{const e=H.value;e.files&&ae.value&&re(e.files[0]).then((()=>{e.value=""}))},de=async()=>{const{serverURL:e,lang:t,login:n,wordLimit:a,requiredMeta:l}=b.value;let o="";b.value.recaptchaV3Key&&(o=await(e=>{const t=ot[e]??(ot[e]=Je.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:e=>t.then((t=>t.execute(e)))}})(b.value.recaptchaV3Key).execute("social"));const r={comment:Q.value,nick:S.value.nick,mail:S.value.mail,link:S.value.link,ua:navigator.userAgent,url:b.value.path,recaptchaV3:o};if(A.value?.token)r.nick=A.value.display_name,r.mail=A.value.email,r.link=A.value.url;else{if("force"===n)return;if(l.indexOf("nick")>-1&&!r.nick)return U.value.nick?.focus(),alert(te.value.nickError);if(l.indexOf("mail")>-1&&!r.mail||r.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(r.mail))return U.value.mail?.focus(),alert(te.value.mailError);if(!r.comment)return void M.value?.focus();r.nick||(r.nick=te.value.anonymous)}if(!X.value)return alert(te.value.wordHint.replace("$0",a[0].toString()).replace("$1",a[1].toString()).replace("$2",Z.value.toString()));r.comment=je(r.comment,N.value.map),w.replyId&&w.rootId&&(r.pid=w.replyId,r.rid=w.rootId,r.at=w.replyUser),ee.value=!0;const i={serverURL:e,lang:t,token:A.value?.token,comment:r};(w.edit?ue({objectId:w.edit.objectId,...i}):(({serverURL:e,lang:t,token:n,comment:a})=>{const l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(a)}).then((e=>e.json()))})(i)).then((e=>{if(ee.value=!1,e.errmsg)return alert(e.errmsg);y("submit",e.data),j.value="",G.value="",w.replyId&&y("cancelReply"),w.edit?.objectId&&y("cancelEdit")})).catch((e=>{ee.value=!1,alert(e.message)}))},ve=e=>{e.preventDefault();const{lang:t,serverURL:n}=b.value;(({lang:e,serverURL:t})=>{const n=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,l=window.open(`${t}/ui/login?lng=${encodeURIComponent(e)}`,"_blank",`width=450,height=450,left=${n},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);return l?.postMessage({type:"TOKEN",data:null},"*"),new Promise((e=>{const t=({data:n})=>{n&&"object"==typeof n&&"userInfo"===n.type&&n.data.token&&(l?.close(),window.removeEventListener("message",t),e(n.data))};window.addEventListener("message",t)}))})({serverURL:n,lang:t}).then((e=>{A.value=e,(e.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e)),y("log")}))},pe=()=>{A.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),y("log")},ge=e=>{e.preventDefault();const{lang:t,serverURL:n}=b.value,a=(window.innerWidth-800)/2,l=(window.innerHeight-800)/2,o=new URLSearchParams({lng:t,token:A.value.token});window.open(`${n}/ui/profile?${o.toString()}`,"_blank",`width=800,height=800,left=${a},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:A.value.token},"*")},he=e=>{O.value?.contains(e.target)||P.value?.contains(e.target)||(W.value=!1),V.value?.contains(e.target)||B.value?.contains(e.target)||(K.value=!1)},fe=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:a}=e.target,l=(n+t)/a,o=b.value.search,r=D.value?.value||"";l<.9||J.loading||(J.loading=!0,J.list=[...J.list,...o.more&&J.list.length?await o.more(r,J.list.length):await o.search(r)],J.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},ye=z((e=>{J.list=[],fe(e)}),300);r([b,Z],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(Y.value=n[0],X.value=!1):t>n[1]?(Y.value=n[1],X.value=!1):(Y.value=n[1],X.value=!0):(Y.value=0,X.value=!0)}),{immediate:!0});const we=({data:e})=>{e&&"profile"===e.type&&(A.value={...A.value,...e.data},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(A)))))};return o((()=>{document.body.addEventListener("click",he),window.addEventListener("message",we),w.edit?.objectId&&(j.value=w.edit.orig),r(K,(async e=>{if(!e)return;const t=b.value.search;D.value&&(D.value.value=""),J.loading=!0,J.list=t.default?await t.default():await t.search(""),J.loading=!1})),r((()=>j.value),(e=>{const{highlighter:t,texRenderer:n}=b.value;Q.value=e,G.value=Se(e,{emojiMap:N.value.map,highlighter:t,texRenderer:n}),Z.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?T(M.value):T.destroy(M.value)}),{immediate:!0}),r((()=>b.value.emoji),(e=>{return(t=e,Promise.all(t.map((e=>"string"==typeof e?be(me(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:a,icon:l,prefix:o,type:r,items:i}=e;t.tabs.push({name:n,icon:ke(l,a,o,r),items:i.map((e=>{const n=`${o||""}${e}`;return t.map[n]=ke(e,a,o,r),n}))})})),t}))).then((e=>{N.value=e}));var t}),{immediate:!0})})),i((()=>{document.body.removeEventListener("click",he),window.removeEventListener("message",we)})),(t,n)=>(c(),u("div",Ct,["disable"!==s(b).login&&s(ne)&&!e.edit?.objectId?(c(),u("div",$t,[d("div",Lt,[d("button",{type:"submit",class:"wl-logout-btn",title:s(te).logout,onClick:pe},[C(s(_e),{size:14})],8,Rt),d("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:s(te).profile,onClick:ge},[d("img",{src:s(A).avatar,alt:"avatar"},null,8,Et)],8,xt)]),d("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:s(te).profile,onClick:ge,textContent:m(s(A).display_name)},null,8,It)])):f("v-if",!0),d("div",jt,["force"!==s(b).login&&s(b).meta.length&&!s(ne)?(c(),u("div",{key:0,class:g(["wl-header",`item${s(b).meta.length}`])},[(c(!0),u(v,null,p(s(b).meta,(e=>(c(),u("div",{key:e,class:"wl-header-item"},[d("label",{for:`wl-${e}`,textContent:m(s(te)[e]+(s(b).requiredMeta.includes(e)||!s(b).requiredMeta.length?"":`(${s(te).optional})`))},null,8,St),$(d("input",{id:`wl-${e}`,ref_for:!0,ref:t=>{t&&(U.value[e]=t)},"onUpdate:modelValue":t=>s(S)[e]=t,class:g(["wl-input",`wl-${e}`]),name:e,type:"mail"===e?"email":"text"},null,10,At),[[L,s(S)[e]]])])))),128))],2)):f("v-if",!0),$(d("textarea",{id:"wl-edit",ref_key:"editorRef",ref:M,"onUpdate:modelValue":n[0]||(n[0]=e=>R(j)?j.value=e:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:s(te).placeholder,onKeydown:oe,onDrop:ie,onPaste:se},null,40,Ut),[[x,s(j)]]),$(d("div",_t,[zt,d("h4",null,m(s(te).preview)+":",1),d("div",{class:"wl-content",innerHTML:G.value},null,8,Mt)],512),[[E,q.value]]),d("div",Ht,[d("div",Tt,[d("a",Ot,[C(s(Pe))]),$(d("button",{ref_key:"emojiButtonRef",ref:O,type:"button",class:g(["wl-action",{active:W.value}]),title:s(te).emoji,onClick:n[1]||(n[1]=e=>W.value=!W.value)},[C(s(Me))],10,Pt),[[E,N.value.tabs.length]]),s(b).search?(c(),u("button",{key:0,ref_key:"gifButtonRef",ref:V,type:"button",class:g(["wl-action",{active:K.value}]),title:s(te).gif,onClick:n[2]||(n[2]=e=>K.value=!K.value)},[C(s(Fe))],10,Vt)):f("v-if",!0),d("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:H,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:ce},null,544),s(ae)?(c(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:s(te).uploadImage},[C(s(He))],8,Bt)):f("v-if",!0),d("button",{type:"button",class:g(["wl-action",{active:q.value}]),title:s(te).preview,onClick:n[3]||(n[3]=e=>q.value=!q.value)},[C(s(Oe))],10,Dt)]),d("div",Nt,[d("div",Ft,[I(m(Z.value)+" ",1),s(b).wordLimit?(c(),u("span",Wt,[I(" / "),d("span",{class:g({illegal:!X.value}),textContent:m(Y.value)},null,10,Kt)])):f("v-if",!0),I(" "+m(s(te).word),1)]),"disable"===s(b).login||s(ne)?f("v-if",!0):(c(),u("button",{key:0,type:"button",class:"wl-btn",onClick:ve,textContent:m(s(te).login)},null,8,qt)),"force"!==s(b).login||s(ne)?(c(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:ee.value,onClick:de},[ee.value?(c(),h(s(Ne),{key:0,size:16})):(c(),u(v,{key:1},[I(m(s(te).submit),1)],64))],8,Gt)):f("v-if",!0)]),d("div",{ref_key:"gifPopupRef",ref:B,class:g(["wl-gif-popup",{display:K.value}])},[d("input",{ref_key:"gifSearchInputRef",ref:D,type:"text",placeholder:s(te).gifSearchPlaceholder,onInput:n[4]||(n[4]=(...e)=>s(ye)&&s(ye)(...e))},null,40,Zt),C(kt,{items:J.list,"column-width":200,gap:6,onInsert:n[5]||(n[5]=e=>le(e)),onScroll:fe},null,8,["items"]),J.loading?(c(),u("div",Jt,[C(s(Ne),{size:30})])):f("v-if",!0)],2),d("div",{ref_key:"emojiPopupRef",ref:P,class:g(["wl-emoji-popup",{display:W.value}])},[(c(!0),u(v,null,p(N.value.tabs,((e,t)=>(c(),u(v,{key:e.name},[t===F.value?(c(),u("div",Yt,[(c(!0),u(v,null,p(e.items,(e=>(c(),u("button",{key:e,type:"button",title:e,onClick:t=>le(`:${e}:`)},[W.value?(c(),u("img",{key:0,class:"wl-emoji",src:N.value.map[e],alt:e,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Qt)):f("v-if",!0)],8,Xt)))),128))])):f("v-if",!0)],64)))),128)),N.value.tabs.length>1?(c(),u("div",en,[(c(!0),u(v,null,p(N.value.tabs,((e,t)=>(c(),u("button",{key:e.name,type:"button",class:g(["wl-tab",{active:F.value===t}]),onClick:e=>F.value=t},[d("img",{class:"wl-emoji",src:e.icon,alt:e.name,title:e.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,nn)],10,tn)))),128))])):f("v-if",!0)],2)])]),e.replyId||e.edit?.objectId?(c(),u("button",{key:1,type:"button",class:"wl-close",title:s(te).cancelReply,onClick:n[6]||(n[6]=n=>t.$emit(e.replyId?"cancelReply":"cancelEdit"))},[C(s(_e),{size:24})],8,an)):f("v-if",!0)]))}}),on=ft(ln,[["__file","CommentBox.vue"]]);const rn=["id"],sn={class:"wl-user","aria-hidden":"true"},cn=["src"],un={class:"wl-card"},dn={class:"wl-head"},mn=["href"],vn={key:1,class:"wl-nick"},pn=["textContent"],gn=["textContent"],hn=["textContent"],fn=["textContent"],yn=["textContent"],wn={class:"wl-comment-actions"},bn=["title"],kn=["textContent"],Cn=["title"],$n={class:"wl-meta","aria-hidden":"true"},Ln=["data-value","textContent"],Rn=["data-value","textContent"],xn=["data-value","textContent"],En=["innerHTML"],In={key:1,class:"wl-admin-actions"},jn={class:"wl-comment-status"},Sn=["disabled","onClick","textContent"],An={key:3,class:"wl-quote"};var Un=ft(t({__name:"CommentCard",props:{comment:null,edit:{default:null},rootId:null,reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e){const t=e,a=["approved","waiting","spam"],o=n("config"),r=Ke(),i=M(),y=it(),w=l((()=>o.value.locale)),b=l((()=>{const{link:e}=t.comment;return e?ve(e)?e:`https://${e}`:""})),k=l((()=>r.value.includes(t.comment.objectId))),$=l((()=>we(t.comment.insertedAt,i.value,w.value))),L=l((()=>"administrator"===y.value.type)),R=l((()=>t.comment.user_id&&y.value.objectId===t.comment.user_id)),x=l((()=>t.comment.objectId===t.reply?.objectId)),E=l((()=>t.comment.objectId===t.edit?.objectId));return(t,n)=>{const l=j("CommentCard",!0);return c(),u("div",{id:e.comment.objectId,class:"wl-item"},[d("div",sn,[e.comment.avatar?(c(),u("img",{key:0,src:e.comment.avatar},null,8,cn)):f("v-if",!0),e.comment.type?(c(),h(s(De),{key:1})):f("v-if",!0)]),d("div",un,[d("div",dn,[s(b)?(c(),u("a",{key:0,class:"wl-nick",href:s(b),target:"_blank",rel:"noopener noreferrer"},m(e.comment.nick),9,mn)):(c(),u("span",vn,m(e.comment.nick),1)),"administrator"===e.comment.type?(c(),u("span",{key:2,class:"wl-badge",textContent:m(s(w).admin)},null,8,pn)):f("v-if",!0),e.comment.label?(c(),u("span",{key:3,class:"wl-badge",textContent:m(e.comment.label)},null,8,gn)):f("v-if",!0),e.comment.sticky?(c(),u("span",{key:4,class:"wl-badge",textContent:m(s(w).sticky)},null,8,hn)):f("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(c(),u("span",{key:5,class:g(`wl-badge level${e.comment.level}`),textContent:m(s(w)[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,fn)):f("v-if",!0),d("span",{class:"wl-time",textContent:m(s($))},null,8,yn),d("div",wn,[s(L)||s(R)?(c(),u("button",{key:0,type:"button",class:"wl-edit",onClick:n[0]||(n[0]=()=>t.$emit("edit",e.comment))},[C(s(Be))])):f("v-if",!0),s(L)||s(R)?(c(),u("button",{key:1,type:"button",class:"wl-delete",onClick:n[1]||(n[1]=n=>t.$emit("delete",e.comment))},[C(s(ze))])):f("v-if",!0),d("button",{type:"button",class:"wl-like",title:s(k)?s(w).cancelLike:s(w).like,onClick:n[2]||(n[2]=n=>t.$emit("like",e.comment))},[C(s(Te),{active:s(k)},null,8,["active"]),"like"in e.comment?(c(),u("span",{key:0,textContent:m(e.comment.like)},null,8,kn)):f("v-if",!0)],8,bn),d("button",{type:"button",class:g(["wl-reply",{active:s(x)}]),title:s(x)?s(w).cancelReply:s(w).reply,onClick:n[3]||(n[3]=n=>t.$emit("reply",s(x)?null:e.comment))},[C(s(Ve))],10,Cn)])]),d("div",$n,[e.comment.addr?(c(),u("span",{key:0,class:"wl-addr","data-value":e.comment.addr,textContent:m(e.comment.addr)},null,8,Ln)):f("v-if",!0),e.comment.browser?(c(),u("span",{key:1,class:"wl-browser","data-value":e.comment.browser,textContent:m(e.comment.browser)},null,8,Rn)):f("v-if",!0),e.comment.os?(c(),u("span",{key:2,class:"wl-os","data-value":e.comment.os,textContent:m(e.comment.os)},null,8,xn)):f("v-if",!0)]),s(E)?f("v-if",!0):(c(),u("div",{key:0,class:"wl-content",innerHTML:e.comment.comment},null,8,En)),s(L)&&!s(E)?(c(),u("div",In,[d("span",jn,[(c(),u(v,null,p(a,(n=>d("button",{key:n,type:"submit",class:g(`wl-btn wl-${n}`),disabled:e.comment.status===n,onClick:a=>t.$emit("status",{status:n,comment:e.comment}),textContent:m(s(w)[n])},null,10,Sn))),64))]),s(L)&&!e.comment.rid?(c(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:n[4]||(n[4]=n=>t.$emit("sticky",e.comment))},m(e.comment.sticky?s(w).unsticky:s(w).sticky),1)):f("v-if",!0)])):f("v-if",!0),s(x)||s(E)?(c(),u("div",{key:2,class:g({"wl-reply-wrapper":s(x),"wl-edit-wrapper":s(E)})},[C(on,{edit:e.edit,"reply-id":e.reply?.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:n[5]||(n[5]=e=>t.$emit("log")),onCancelReply:n[6]||(n[6]=e=>t.$emit("reply",null)),onCancelEdit:n[7]||(n[7]=e=>t.$emit("edit",null)),onSubmit:n[8]||(n[8]=e=>t.$emit("submit",e))},null,8,["edit","reply-id","reply-user","root-id"])],2)):f("v-if",!0),e.comment.children?(c(),u("div",An,[(c(!0),u(v,null,p(e.comment.children,(a=>(c(),h(l,{key:a.objectId,comment:a,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:n[9]||(n[9]=e=>t.$emit("log")),onDelete:n[10]||(n[10]=e=>t.$emit("delete",e)),onEdit:n[11]||(n[11]=e=>t.$emit("edit",e)),onLike:n[12]||(n[12]=e=>t.$emit("like",e)),onReply:n[13]||(n[13]=e=>t.$emit("reply",e)),onStatus:n[14]||(n[14]=e=>t.$emit("status",e)),onSticky:n[15]||(n[15]=e=>t.$emit("sticky",e)),onSubmit:n[16]||(n[16]=e=>t.$emit("submit",e))},null,8,["comment","reply","edit","root-id"])))),128))])):f("v-if",!0)])],8,rn)}}}),[["__file","CommentCard.vue"]]);const _n="2.14.3",zn={"data-waline":""},Mn={class:"wl-meta-head"},Hn={class:"wl-count"},Tn=["textContent"],On={class:"wl-sort"},Pn=["onClick"],Vn={class:"wl-cards"},Bn={key:1,class:"wl-operation"},Dn=["textContent"],Nn={key:0,class:"wl-loading"},Fn=["textContent"],Wn={key:2,class:"wl-operation"},Kn=["textContent"],qn={key:3,class:"wl-power"},Gn=d("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var Zn=t({__name:"WalineComment",props:{serverURL:null,path:null,meta:null,requiredMeta:null,wordLimit:null,pageSize:null,lang:null,locale:null,commentSorting:null,dark:{type:[String,Boolean]},emoji:{type:[Array,Boolean]},search:{type:[Object,Boolean]},highlighter:{type:[Function,Boolean]},imageUploader:{type:[Function,Boolean]},texRenderer:{type:[Function,Boolean]},login:null,copyright:{type:Boolean},recaptchaV3Key:null,reaction:{type:[Array,Boolean]}},setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},y=Object.keys(n),w=it(),b=Ke(),k=a("loading"),$=a(0),L=a(1),R=a(0),x=l((()=>(({serverURL:e,path:t=location.pathname,lang:n=navigator.language,locale:a,emoji:l=B,meta:o=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:d,texRenderer:m,copyright:v=!0,login:p="enable",search:g,reaction:h,recaptchaV3Key:f="",commentSorting:y="latest",...w})=>({serverURL:pe(e),path:de(t),locale:{...oe[n]||oe[D],..."object"==typeof a?a:{}},wordLimit:ge(c),meta:V(o),requiredMeta:V(r),imageUploader:he(u,N),highlighter:he(d,J),texRenderer:he(m,F),lang:n,dark:i,emoji:"boolean"==typeof l?l?B:[]:l,pageSize:s,login:p,copyright:v,search:!1!==g&&("object"==typeof g?g:W(n)),recaptchaV3Key:f,reaction:Array.isArray(h)?h:!0===h?K:[],commentSorting:y,...w}))(t))),E=a(x.value.commentSorting),j=a([]),A=a(null),U=a(null),_=l((()=>{return"string"==typeof(e=x.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${fe}}`:`${e}${fe}`:!0===e?`:root${fe}`:"";var e})),z=l((()=>x.value.locale));let M;H(_);const T=e=>{const{serverURL:t,path:a,pageSize:l}=x.value,o=new AbortController;k.value="loading",M?.(),(({serverURL:e,lang:t,path:n,page:a,pageSize:l,sortBy:o,signal:r,token:i})=>{const s={};return i&&(s.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${a}&lang=${t}&sortBy=${o}`,{signal:r,headers:s}).then((e=>e.json())).then((e=>ie(e,"Get comment data")))})({serverURL:t,lang:x.value.lang,path:a,pageSize:l,sortBy:n[E.value],page:e,signal:o.signal,token:w.value?.token}).then((t=>{k.value="success",$.value=t.count,j.value.push(...t.data),L.value=e,R.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),k.value="error")})),M=o.abort.bind(o)},O=()=>T(L.value+1),P=()=>{$.value=0,j.value=[],T(1)},q=e=>{A.value=e},G=e=>{U.value=e},Z=e=>{if(U.value)U.value.comment=e.comment,U.value.orig=e.orig;else if(e.rid){const t=j.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else j.value.unshift(e)},Y=async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:n,lang:a}=x.value;await ue({serverURL:n,lang:a,token:w.value?.token,objectId:e.objectId,comment:{status:t}}),e.status=t},X=async e=>{if(e.rid)return;const{serverURL:t,lang:n}=x.value;await ue({serverURL:t,lang:n,token:w.value?.token,objectId:e.objectId,comment:{sticky:e.sticky?0:1}}),e.sticky=!e.sticky},Q=async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:n}=x.value;await(({serverURL:e,lang:t,token:n,objectId:a})=>fetch(`${e}/comment/${a}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())).then((e=>ie(e,"Delete comment"))))({serverURL:t,lang:n,token:w.value?.token,objectId:e}),j.value.some(((t,n)=>t.objectId===e?(j.value=j.value.filter(((e,t)=>t!==n)),!0):t.children.some(((a,l)=>a.objectId===e&&(j.value[n].children=t.children.filter(((e,t)=>t!==l)),!0)))))},ee=async e=>{const{serverURL:t,lang:n}=x.value,{objectId:a}=e,l=b.value.includes(a);await ue({serverURL:t,lang:n,objectId:a,token:w.value?.token,comment:{like:!l}}),l?b.value=b.value.filter((e=>e!==a)):(b.value=[...b.value,a],b.value.length>50&&(b.value=b.value.slice(-50))),e.like=(e.like||0)+(l?-1:1)};return S("config",x),o((()=>{r((()=>[t.serverURL,t.path]),(()=>P()),{immediate:!0})})),i((()=>M?.())),(e,t)=>(c(),u("div",zn,[C(yt),A.value?f("v-if",!0):(c(),h(on,{key:0,onLog:P,onSubmit:Z})),d("div",Mn,[d("div",Hn,[$.value?(c(),u("span",{key:0,class:"wl-num",textContent:m($.value)},null,8,Tn)):f("v-if",!0),I(" "+m(s(z).comment),1)]),d("ul",On,[(c(!0),u(v,null,p(s(y),(e=>(c(),u("li",{key:e,class:g([e===E.value?"active":""]),onClick:t=>(e=>{E.value!==e&&(E.value=e,P())})(e)},m(s(z)[e]),11,Pn)))),128))])]),d("div",Vn,[(c(!0),u(v,null,p(j.value,(e=>(c(),h(Un,{key:e.objectId,"root-id":e.objectId,comment:e,reply:A.value,edit:U.value,onLog:P,onReply:q,onEdit:G,onSubmit:Z,onStatus:Y,onDelete:Q,onSticky:X,onLike:ee},null,8,["root-id","comment","reply","edit"])))),128))]),"error"===k.value?(c(),u("div",Bn,[d("button",{type:"button",class:"wl-btn",onClick:P,textContent:m(s(z).refresh)},null,8,Dn)])):(c(),u(v,{key:2},["loading"===k.value?(c(),u("div",Nn,[C(s(Ne),{size:30})])):j.value.length?L.value<R.value?(c(),u("div",Wn,[d("button",{type:"button",class:"wl-btn",onClick:O,textContent:m(s(z).more)},null,8,Kn)])):f("v-if",!0):(c(),u("div",{key:1,class:"wl-empty",textContent:m(s(z).sofa)},null,8,Fn))],64)),s(x).copyright?(c(),u("div",qn,[I(" Powered by "),Gn,I(" v"+m(s(_n)),1)])):f("v-if",!0)]))}}),Jn=ft(Zn,[["__file","WalineComment.vue"]]);const Yn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Xn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:a=!0,lang:l=navigator.language})=>{const o=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=Ae(e);return null!==n&&t!==n},s=n=>(({serverURL:e,lang:t,paths:n,signal:a})=>se({serverURL:e,lang:t,paths:n,type:["time"],signal:a}).then((e=>Array.isArray(e)?e:[e])))({serverURL:pe(e),paths:n.map((e=>Ae(e)||t)),lang:l,signal:o.signal}).then((e=>Yn(e,n))).catch(Ce);if(a){const n=r.filter((e=>!i(e))),a=r.filter(i);(c={serverURL:pe(e),path:t,lang:l},ce({...c,type:"time",action:"inc"})).then((e=>Yn(new Array(n.length).fill(e),n))),a.length&&s(a)}else s(r);var c;return o.abort.bind(o)},Qn=({el:t="#waline",path:n=window.location.pathname,comment:a=!1,pageview:l=!1,...o})=>{const r=t?$e(t):null;if(t&&!r)throw new Error("Option 'el' do not match any domElement!");if(!o.serverURL)throw new Error("Option 'serverURL' is missing!");const i=k({...o}),s=k({comment:a,pageview:l,path:n}),c=r?A((()=>e(Jn,{path:s.path,...i}))):null;c&&c.mount(r);const u=U((()=>{s.comment&&Ue({serverURL:i.serverURL,path:s.path,selector:"string"==typeof s.comment?s.comment:void 0})})),d=U((()=>{s.pageview&&Xn({serverURL:i.serverURL,path:s.path,selector:"string"==typeof s.pageview?s.pageview:void 0})}));return{el:r,update:({comment:e,pageview:t,path:n=window.location.pathname,...a}={})=>{Object.entries(a).forEach((([e,t])=>{i[e]=t})),s.path=n,void 0!==e&&(s.comment=e),void 0!==t&&(s.pageview=t)},destroy:()=>{c?.unmount(),u(),d()}}},ea=({el:e,serverURL:t,count:n,lang:a=navigator.language})=>{const l=it(),o=$e(e),r=new AbortController;return(({serverURL:e,lang:t,count:n,signal:a,token:l})=>{const o={};return l&&(o.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:a,headers:o}).then((e=>e.json()))})({serverURL:t,count:n,lang:a,signal:r.signal,token:l.value?.token}).then((e=>o&&e.length?(o.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(),o.innerHTML=""}}):{comments:e,destroy:()=>r.abort()}))},ta=({el:e,serverURL:t,count:n,locale:a,lang:l=navigator.language,mode:o="list"})=>{const r=$e(e),i=new AbortController;return(({serverURL:e,signal:t,pageSize:n,lang:a})=>fetch(`${e}/user?pageSize=${n}&lang=${a}`,{signal:t}).then((e=>e.json())).then((e=>ie(e,"user list"))).then((e=>e.data)))({serverURL:t,pageSize:n,lang:l,signal:i.signal}).then((e=>r&&e.length?(a={...oe[l]||oe[D],..."object"==typeof a?a:{}},r.innerHTML=`<ul class="wl-user-${o}">${e.map(((e,t)=>[`<li class="wl-user-item" aria-label="${e.nick}">`,e.link&&`<a href="${e.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${e.avatar}" alt="${e.nick}">`,`<span class="wl-user-badge">${t+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',e.nick,e.level&&`<span class="wl-badge">${a?a[`level${e.level}`]:`Level ${e.level}`}</span>`,e.label&&`<span class="wl-badge">${e.label}</span>`,"</div>",e.link&&e.link,"</div>",e.link&&"</a>","</li>"].filter((e=>e)).join(""))).join("")}</ul>`,{users:e,destroy:()=>{i.abort(),r.innerHTML=""}}):{users:e,destroy:()=>i.abort()}))};export{ea as RecentComments,ta as UserList,Ue as commentCount,oe as defaultLocales,Qn as init,Xn as pageviewCount,_n as version};
|
|
2
2
|
//# sourceMappingURL=shim.mjs.map
|