@waline/client 2.0.7 → 2.1.0

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{"AbortError"!==e.name&&console.error(e.message)},t=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},r=({serverURL:e,paths:r,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}`,{signal:n}).then((e=>e.json())).then((e=>t(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),n=({serverURL:e,path:r})=>fetch(`${e}/article`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})}).then((e=>e.json())).then((e=>t(e,"visit count"))),o=e=>e.dataset.path||e.getAttribute("id"),a=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))};exports.pageviewCount=({serverURL:t,path:s=window.location.pathname,selector:i=".waline-pageview-count",update:l=!0})=>{const h=new AbortController,c=Array.from(document.querySelectorAll(i)),p=e=>{const t=o(e);return null!==t&&s!==t},u=n=>r({serverURL:t,paths:n.map((e=>o(e)||s)),signal:h.signal}).then((e=>a(e,n))).catch(e);if(l){const e=c.filter((e=>!p(e))),r=c.filter(p);n({serverURL:t,path:s}).then((t=>a(new Array(e.length).fill(t),e))),r.length&&u(r)}else u(c);return h.abort.bind(h)},exports.version="2.0.7";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{"AbortError"!==e.name&&console.error(e.message)},t=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},r=({serverURL:e,paths:r,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(r.join(","))}`,{signal:n}).then((e=>e.json())).then((e=>t(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),n=({serverURL:e,path:r})=>fetch(`${e}/article`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})}).then((e=>e.json())).then((e=>t(e,"visit count"))),o=e=>e.dataset.path||e.getAttribute("id"),a=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))};exports.pageviewCount=({serverURL:t,path:s=window.location.pathname,selector:i=".waline-pageview-count",update:l=!0})=>{const h=new AbortController,c=Array.from(document.querySelectorAll(i)),p=e=>{const t=o(e);return null!==t&&s!==t},u=n=>r({serverURL:t,paths:n.map((e=>o(e)||s)),signal:h.signal}).then((e=>a(e,n))).catch(e);if(l){const e=c.filter((e=>!p(e))),r=c.filter(p);n({serverURL:t,path:s}).then((t=>a(new Array(e.length).fill(t),e))),r.length&&u(r)}else u(c);return h.abort.bind(h)},exports.version="2.1.0";
2
2
  //# sourceMappingURL=pageview.cjs.js.map
@@ -1,2 +1,2 @@
1
- const e="2.0.7",t=e=>{"AbortError"!==e.name&&console.error(e.message)},r=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},n=({serverURL:e,paths:t,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(t.join(","))}`,{signal:n}).then((e=>e.json())).then((e=>r(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),o=({serverURL:e,path:t})=>fetch(`${e}/article`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}).then((e=>e.json())).then((e=>r(e,"visit count"))),a=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))},s=({serverURL:e,path:r=window.location.pathname,selector:s=".waline-pageview-count",update:h=!0})=>{const l=new AbortController,c=Array.from(document.querySelectorAll(s)),p=e=>{const t=a(e);return null!==t&&r!==t},f=o=>n({serverURL:e,paths:o.map((e=>a(e)||r)),signal:l.signal}).then((e=>i(e,o))).catch(t);if(h){const t=c.filter((e=>!p(e))),n=c.filter(p);o({serverURL:e,path:r}).then((e=>i(new Array(t.length).fill(e),t))),n.length&&f(n)}else f(c);return l.abort.bind(l)};export{s as pageviewCount,e as version};
1
+ const e="2.1.0",t=e=>{"AbortError"!==e.name&&console.error(e.message)},r=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},n=({serverURL:e,paths:t,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(t.join(","))}`,{signal:n}).then((e=>e.json())).then((e=>r(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),o=({serverURL:e,path:t})=>fetch(`${e}/article`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}).then((e=>e.json())).then((e=>r(e,"visit count"))),a=e=>e.dataset.path||e.getAttribute("id"),i=(e,t)=>{t.forEach(((t,r)=>{t.innerText=e[r].toString()}))},s=({serverURL:e,path:r=window.location.pathname,selector:s=".waline-pageview-count",update:h=!0})=>{const l=new AbortController,c=Array.from(document.querySelectorAll(s)),p=e=>{const t=a(e);return null!==t&&r!==t},f=o=>n({serverURL:e,paths:o.map((e=>a(e)||r)),signal:l.signal}).then((e=>i(e,o))).catch(t);if(h){const t=c.filter((e=>!p(e))),n=c.filter(p);o({serverURL:e,path:r}).then((e=>i(new Array(t.length).fill(e),t))),n.length&&f(n)}else f(c);return l.abort.bind(l)};export{s as pageviewCount,e as version};
2
2
  //# sourceMappingURL=pageview.esm.js.map
package/dist/pageview.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.0.7";const t=e=>{"AbortError"!==e.name&&console.error(e.message)},n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError("Fetch ".concat(t," failed with ").concat(e.errno,": ").concat(e.errmsg));return e},r=e=>{let{serverURL:t,paths:r,signal:o}=e;return fetch("".concat(t,"/article?path=").concat(encodeURIComponent(r.join(","))),{signal:o}).then((e=>e.json())).then((e=>n(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},o=e=>{let{serverURL:t,path:r}=e;return fetch("".concat(t,"/article"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})}).then((e=>e.json())).then((e=>n(e,"visit count")))},i=e=>e.dataset.path||e.getAttribute("id"),a=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:n,path:s=window.location.pathname,selector:l=".waline-pageview-count",update:c=!0}=e;const f=new AbortController,h=Array.from(document.querySelectorAll(l)),p=e=>{const t=i(e);return null!==t&&s!==t},d=e=>r({serverURL:n,paths:e.map((e=>i(e)||s)),signal:f.signal}).then((t=>a(t,e))).catch(t);if(c){const e=h.filter((e=>!p(e))),t=h.filter(p);o({serverURL:n,path:s}).then((t=>a(new Array(e.length).fill(t),e))),t.length&&d(t)}else d(h);return f.abort.bind(f)}}));
1
+ !function(e,t){if("function"==typeof define&&define.amd)define("Waline",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.Waline=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.pageviewCount=void 0;e.version="2.1.0";const t=e=>{"AbortError"!==e.name&&console.error(e.message)},n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("object"==typeof e&&e.errno)throw new TypeError("Fetch ".concat(t," failed with ").concat(e.errno,": ").concat(e.errmsg));return e},r=e=>{let{serverURL:t,paths:r,signal:o}=e;return fetch("".concat(t,"/article?path=").concat(encodeURIComponent(r.join(","))),{signal:o}).then((e=>e.json())).then((e=>n(e,"visit count"))).then((e=>Array.isArray(e)?e:[e]))},o=e=>{let{serverURL:t,path:r}=e;return fetch("".concat(t,"/article"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})}).then((e=>e.json())).then((e=>n(e,"visit count")))},i=e=>e.dataset.path||e.getAttribute("id"),a=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))};e.pageviewCount=e=>{let{serverURL:n,path:s=window.location.pathname,selector:l=".waline-pageview-count",update:c=!0}=e;const f=new AbortController,h=Array.from(document.querySelectorAll(l)),p=e=>{const t=i(e);return null!==t&&s!==t},d=e=>r({serverURL:n,paths:e.map((e=>i(e)||s)),signal:f.signal}).then((t=>a(t,e))).catch(t);if(c){const e=h.filter((e=>!p(e))),t=h.filter(p);o({serverURL:n,path:s}).then((t=>a(new Array(e.length).fill(t),e))),t.length&&d(t)}else d(h);return f.abort.bind(f)}}));
2
2
  //# sourceMappingURL=pageview.js.map
package/dist/shim.d.ts CHANGED
@@ -64,9 +64,17 @@ interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
64
64
  sticky?: boolean;
65
65
  browser?: string;
66
66
  os?: string;
67
+ level?: number;
67
68
  }
68
69
 
69
- interface WalineLocale {
70
+ interface WalineDateLocale {
71
+ seconds: string;
72
+ minutes: string;
73
+ hours: string;
74
+ days: string;
75
+ now: string;
76
+ }
77
+ interface WalineLocale extends WalineDateLocale {
70
78
  nick: string;
71
79
  nickError: string;
72
80
  mail: string;
@@ -84,11 +92,6 @@ interface WalineLocale {
84
92
  preview: string;
85
93
  emoji: string;
86
94
  uploadImage: string;
87
- seconds: string;
88
- minutes: string;
89
- hours: string;
90
- days: string;
91
- now: string;
92
95
  uploading: string;
93
96
  login: string;
94
97
  logout: string;
@@ -229,7 +232,7 @@ interface WalineProps {
229
232
  *
230
233
  * @default ['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo']
231
234
  */
232
- emoji?: (string | WalineEmojiInfo)[];
235
+ emoji?: (string | WalineEmojiInfo)[] | false;
233
236
  /**
234
237
  * 代码高亮
235
238
  *
@@ -457,4 +460,4 @@ interface WalineRecentCommentsResult {
457
460
  }
458
461
  declare const RecentComments: ({ el, serverURL, count, }: WalineRecentCommentsOptions) => Promise<WalineRecentCommentsResult>;
459
462
 
460
- export { Locales, RecentComments, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineEmojiInfo, WalineEmojiMaps, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLocale, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineTexRenderer, commentCount, defaultLang, defaultTexRenderer, defaultUploadImage, getMeta, init, locales, pageviewCount, version };
463
+ export { Locales, RecentComments, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineDateLocale, WalineEmojiInfo, WalineEmojiMaps, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLocale, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineTexRenderer, commentCount, defaultLang, defaultTexRenderer, defaultUploadImage, getMeta, init, locales, pageviewCount, version };
@@ -64,9 +64,17 @@ interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
64
64
  sticky?: boolean;
65
65
  browser?: string;
66
66
  os?: string;
67
+ level?: number;
67
68
  }
68
69
 
69
- interface WalineLocale {
70
+ interface WalineDateLocale {
71
+ seconds: string;
72
+ minutes: string;
73
+ hours: string;
74
+ days: string;
75
+ now: string;
76
+ }
77
+ interface WalineLocale extends WalineDateLocale {
70
78
  nick: string;
71
79
  nickError: string;
72
80
  mail: string;
@@ -84,11 +92,6 @@ interface WalineLocale {
84
92
  preview: string;
85
93
  emoji: string;
86
94
  uploadImage: string;
87
- seconds: string;
88
- minutes: string;
89
- hours: string;
90
- days: string;
91
- now: string;
92
95
  uploading: string;
93
96
  login: string;
94
97
  logout: string;
@@ -229,7 +232,7 @@ interface WalineProps {
229
232
  *
230
233
  * @default ['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo']
231
234
  */
232
- emoji?: (string | WalineEmojiInfo)[];
235
+ emoji?: (string | WalineEmojiInfo)[] | false;
233
236
  /**
234
237
  * 代码高亮
235
238
  *
@@ -457,4 +460,4 @@ interface WalineRecentCommentsResult {
457
460
  }
458
461
  declare const RecentComments: ({ el, serverURL, count, }: WalineRecentCommentsOptions) => Promise<WalineRecentCommentsResult>;
459
462
 
460
- export { Locales, RecentComments, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineEmojiInfo, WalineEmojiMaps, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLocale, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineTexRenderer, commentCount, defaultLang, defaultTexRenderer, defaultUploadImage, getMeta, init, locales, pageviewCount, version };
463
+ export { Locales, RecentComments, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineDateLocale, WalineEmojiInfo, WalineEmojiMaps, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLocale, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineTexRenderer, commentCount, defaultLang, defaultTexRenderer, defaultUploadImage, getMeta, init, locales, pageviewCount, version };
package/dist/shim.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{ref as e,unref as t,isRef as n,watch as o,getCurrentScope as r,onScopeDispose as l,shallowRef as a,computed as i,h as s,defineComponent as c,inject as u,onMounted as m,onUnmounted as d,resolveComponent as p,openBlock as v,createElementBlock as g,createElementVNode as f,createVNode as h,toDisplayString as w,createCommentVNode as y,normalizeClass as b,Fragment as k,renderList as C,withDirectives as $,vModelDynamic as I,vModelText as L,vShow as j,createTextVNode as S,createBlock as R,provide as x,watchEffect as E,onBeforeUnmount as A,reactive as U,createApp as z}from"vue";import M from"autosize";import{marked as O}from"marked";import P from"hanabi";const N=["nick","mail","link"],T=e=>e.filter((e=>N.includes(e))),_="zh-CN",B=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>{var e;return t((null===(e=o.result)||void 0===e?void 0:e.toString())||"")},o.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>',D=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous"],q=e=>Object.fromEntries(e.map(((e,t)=>[D[t],e])));var H=q(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","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"]),W=q(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),V=q(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名"]),J=q(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名"]),K=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","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"]),Y=q(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const G={zh:V,"zh-cn":V,"zh-CN":V,"zh-tw":J,"zh-TW":J,en:H,"en-US":H,"en-us":H,jp:W,"jp-jp":W,"jp-JP":W,"pt-br":K,"pt-BR":K,ru:Y,"ru-ru":Y,"ru-RU":Y};function X(e){return!!r()&&(l(e),!0)}const Q="undefined"!=typeof window,Z=()=>{};const ee=e=>e();var te=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;function re(e,t,n={}){const r=n,{eventFilter:l=ee}=r,a=((e,t)=>{var n={};for(var o in e)ne.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&te)for(var o of te(e))t.indexOf(o)<0&&oe.call(e,o)&&(n[o]=e[o]);return n})(r,["eventFilter"]);return o(e,(i=l,s=t,function(...e){i((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),a);var i,s}var le=Object.defineProperty,ae=Object.defineProperties,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,me=(e,t,n)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function de(t,n,o={}){const r=o,{eventFilter:l}=r,a=((e,t)=>{var n={};for(var o in e)ce.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&se)for(var o of se(e))t.indexOf(o)<0&&ue.call(e,o)&&(n[o]=e[o]);return n})(r,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(t=ee){const n=e(!0);return{isActive:n,pause:function(){n.value=!1},resume:function(){n.value=!0},eventFilter:(...e)=>{n.value&&t(...e)}}}(l),m=re(t,n,(d=((e,t)=>{for(var n in t||(t={}))ce.call(t,n)&&me(e,n,t[n]);if(se)for(var n of se(t))ue.call(t,n)&&me(e,n,t[n]);return e})({},a),ae(d,ie({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const pe=Q?window:void 0;function ve(...e){let n,r,l,a;if("string"==typeof e[0]?([r,l,a]=e,n=pe):[n,r,l,a]=e,!n)return Z;let i=Z;const s=o((()=>function(e){var n;const o=t(e);return null!=(n=null==o?void 0:o.$el)?n:o}(n)),(e=>{i(),e&&(e.addEventListener(r,l,a),i=()=>{e.removeEventListener(r,l,a),i=Z})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return X(c),c}Q&&window.document,Q&&window.navigator,Q&&window.location;const ge="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},fe="__vueuse_ssr_handlers__";ge[fe]=ge[fe]||{};const he=ge[fe];const we={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function ye(n,o,r,l={}){var i;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:p=pe,eventFilter:v,onError:g=(e=>{console.error(e)})}=l,f=(d?a:e)(o);if(!r)try{r=function(e,t){return he[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=pe)?void 0:e.localStorage}))()}catch(e){g(e)}if(!r)return f;const h=t(o),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(i=l.serializer)?i:we[w],{pause:b,resume:k}=de(f,(()=>function(e){try{null==e?r.removeItem(n):r.setItem(n,y.write(e))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:v});return p&&u&&ve(p,"storage",C),C(),f;function C(e){e&&e.key!==n||(f.value=function(e){if(!e||e.key===n){b();try{const t=e?e.newValue:r.getItem(n);return null==t?(m&&null!==h&&r.setItem(n,y.write(h)),h):"string"!=typeof t?t:y.read(t)}catch(e){g(e)}finally{k()}}}(e))}}var be,ke,Ce=Object.defineProperty,$e=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,je=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Se(r={}){const{controls:l=!1,interval:a="requestAnimationFrame"}=r,i=e(new Date),s=()=>i.value=new Date,c="requestAnimationFrame"===a?function(t,n={}){const{immediate:o=!0,window:r=pe}=n,l=e(!1);let a=null;function i(){l.value&&r&&(t(),a=r.requestAnimationFrame(i))}function s(){!l.value&&r&&(l.value=!0,i())}function c(){l.value=!1,null!=a&&r&&(r.cancelAnimationFrame(a),a=null)}return o&&s(),X(c),{isActive:l,pause:c,resume:s}}(s,{immediate:!0}):function(r,l=1e3,a={}){const{immediate:i=!0,immediateCallback:s=!1}=a;let c=null;const u=e(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function p(){l<=0||(u.value=!0,s&&r(),m(),c=setInterval(r,t(l)))}i&&Q&&p(),n(l)&&X(o(l,(()=>{i&&Q&&p()})));return X(d),{isActive:u,pause:d,resume:p}}(s,a,{immediate:!0});return l?((e,t)=>{for(var n in t||(t={}))Ie.call(t,n)&&je(e,n,t[n]);if($e)for(var n of $e(t))Le.call(t,n)&&je(e,n,t[n]);return e})({now:i},c):i}Q&&(null==window?void 0:window.navigator)&&(null==(be=null==window?void 0:window.navigator)?void 0:be.platform)&&/iP(ad|hone|od)/.test(null==(ke=null==window?void 0:window.navigator)?void 0:ke.platform);const Re=e=>{try{e=decodeURI(e)}catch(e){}return e},xe=(e="")=>e.replace(/\/$/u,""),Ee=e=>/^(https?:)?\/\//.test(e),Ae=e=>{const t=xe(e);return Ee(t)?t:`https://${t}`},Ue=e=>Array.isArray(e)?e:!!e&&[0,e],ze=(e,t)=>"function"==typeof e?e:!1!==e&&t,Me="{--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}",Oe=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Pe=e=>{const t=ye("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((o=>{const r={folder:e,...o};return n&&(t.value[e]=r),r}))},Ne=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,Te=e=>{"AbortError"!==e.name&&console.error(e.message)},_e=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},Be=({serverURL:e,paths:t,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(t.join(","))}`,{signal:n}).then((e=>e.json())).then((e=>_e(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),Fe=({serverURL:e,path:t})=>fetch(`${e}/article`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}).then((e=>e.json())).then((e=>_e(e,"visit count"))),De=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,qe=e=>e.type.includes("image"),He=e=>{const t=Array.from(e).find(qe);return t?t.getAsFile():null},We=/\$.*?\$/,Ve=/^\$(.*?)\$/,Je=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ke=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Ye=(e,{emojiMap:t,highlighter:n,texRenderer:o})=>{if(O.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),o){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Je.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(We);return-1!==t?t:e.length},tokenizer(t){const n=Ve.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);O.use({extensions:e})}return O.parse(Ke(e,t))},Ge=e=>e.dataset.path||e.getAttribute("id"),Xe=(e,t)=>{const n=Se();return i((()=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,r=n.value.getTime()-o.getTime(),l=Math.floor(r/864e5);if(0===l){const e=r%864e5,n=Math.floor(e/36e5);if(0===n){const n=e%36e5,o=Math.floor(n/6e4);if(0===o){const e=n%6e4;return`${Math.round(e/1e3)} ${t.seconds}`}return`${o} ${t.minutes}`}return`${n} ${t.hours}`}return l<0?t.now:l<8?`${l} ${t.days}`:(e=>{const t=Oe(e.getDate(),2),n=Oe(e.getMonth()+1,2);return`${Oe(e.getFullYear(),2)}-${n}-${t}`})(o)}))},Qe=()=>ye("USER_KEY",{}),Ze=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count"})=>{var o;const r=new AbortController,l=document.querySelectorAll(n),a=Qe();return l.length&&(({serverURL:e,paths:t,signal:n,token:o})=>{const r={};return o&&(r.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(t.join(","))}`,{signal:n,headers:r}).then((e=>e.json())).then((e=>_e(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(l).map((e=>Re(e.dataset.path||e.getAttribute("id")||t))),signal:r.signal,token:null===(o=a.value)||void 0===o?void 0:o.token}).then((e=>{l.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(Te),r.abort.bind(r)},et=({size:e})=>s("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},s("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},s("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var tt=c({name:"CommentBox",components:{CloseIcon:({size:e})=>s("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[s("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"}),s("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:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},s("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:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("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"}),s("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"})]),MarkdownIcon:()=>s("svg",{width:"16",height:"16",ariaHidden:"true"},s("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:()=>s("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[s("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"}),s("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:et},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(t,{emit:n}){const r=u("config"),l=ye("WALINE_COMMENT_BOX_EDITOR",""),a=ye("WALINE_USER_META",{nick:"",mail:"",link:""}),s=Qe(),c=e({}),p=e(null),v=e(null),g=e(null),f=e(null),h=e({tabs:[],map:{}}),w=e(0),y=e(!1),b=e(!1),k=e(""),C=e(0),$=e(0),I=e(!1),L=e(""),j=e(!1),S=i((()=>r.value.locale)),R=i((()=>{var e;return Boolean(null===(e=s.value)||void 0===e?void 0:e.token)})),x=i((()=>!1!==r.value.imageUploader)),E=e=>{const t=p.value,n=t.selectionStart,o=t.selectionEnd||0,r=t.scrollTop;l.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=r},A=e=>{const t=`![${r.value.locale.uploading} ${e.name}]()`;return E(t),Promise.resolve().then((()=>r.value.imageUploader(e))).then((n=>{l.value=l.value.replace(t,`\r\n![${e.name}](${n})`)}))},U=()=>{var e,o,i,u,m;const{serverURL:d,lang:v,login:g,wordLimit:f,requiredMeta:w}=r.value,y={comment:L.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:r.value.path};if(null===(e=s.value)||void 0===e?void 0:e.token)y.nick=s.value.display_name,y.mail=s.value.email,y.link=s.value.url;else{if("force"===g)return;if((w.indexOf("nick")>-1||y.nick)&&!y.nick)return null===(o=c.value.nick)||void 0===o||o.focus(),alert(S.value.nickError);if(w.indexOf("mail")>-1&&!y.mail)return null===(i=c.value.mail)||void 0===i||i.focus(),alert(S.value.mailError);if(!y.comment)return void(null===(u=p.value)||void 0===u||u.focus());y.nick||(y.nick=S.value.anonymous)}if(!I.value)return alert(S.value.wordHint.replace("$0",f[0].toString()).replace("$1",f[1].toString()).replace("$2",C.value.toString()));y.comment=Ke(y.comment,h.value.map),t.replyId&&t.rootId&&(y.pid=t.replyId,y.rid=t.rootId,y.at=t.replyUser),j.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const r={"Content-Type":"application/json"};return n&&(r.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:d,lang:v,token:null===(m=s.value)||void 0===m?void 0:m.token,comment:y}).then((e=>{if(j.value=!1,e.errmsg)return alert(e.errmsg);n("submit",e.data),l.value="",k.value="",t.replyId&&n("cancel-reply")})).catch((e=>{j.value=!1,alert(e.message)}))},z=e=>{g.value.contains(e.target)||f.value.contains(e.target)||(y.value=!1)};return o([r,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?($.value=n[0],I.value=!1):t>n[1]?($.value=n[1],I.value=!1):($.value=n[1],I.value=!0):($.value=0,I.value=!0)}),{immediate:!0}),m((()=>{document.body.addEventListener("click",z),o((()=>l.value),(e=>{const{highlighter:t,texRenderer:n}=r.value;L.value=e,k.value=Ye(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),C.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?M(p.value):M.destroy(p.value)}),{immediate:!0}),o((()=>r.value.emoji),(e=>{return(t=e,Promise.all(t.map((e=>"string"==typeof e?Pe(xe(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:r,prefix:l,type:a,items:i}=e;t.tabs.push({name:n,icon:Ne(r,o,l,a),items:i.map((e=>{const n=`${l||""}${e}`;return t.map[n]=Ne(e,o,l,a),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),d((()=>{document.body.removeEventListener("click",z)})),{config:r,locale:S,insert:E,onChange:()=>{const e=v.value;e.files&&x.value&&A(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{var t;if(null===(t=e.dataTransfer)||void 0===t?void 0:t.items){const t=He(e.dataTransfer.items);t&&x.value&&(A(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&U()},onPaste:e=>{if(e.clipboardData){const t=He(e.clipboardData.items);t&&x.value&&A(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=r.value,o=(window.innerWidth-450)/2,l=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);null==a||a.postMessage({type:"TOKEN",data:null},"*");const i=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(null==a||a.close(),s.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",i))};window.addEventListener("message",i)},onLogout:()=>{s.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=r.value,o=(window.innerWidth-800)/2,l=(window.innerHeight-800)/2,a=window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);null==a||a.postMessage({type:"TOKEN",data:s.value.token},"*");const i=({data:e})=>{e&&"profile"===e.type&&(s.value={...s.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(s)))),window.removeEventListener("message",i))};window.addEventListener("message",i)},submitComment:U,isLogin:R,userInfo:s,isSubmitting:j,wordNumber:C,wordLimit:$,isWordNumberLegal:I,editor:l,userMeta:a,emoji:h,emojiTabIndex:w,showEmoji:y,canUploadImage:x,previewText:k,showPreview:b,inputRefs:c,editorRef:p,emojiButtonRef:g,emojiPopupRef:f,imageUploadRef:v}}});const nt={class:"wl-comment"},ot={key:0,class:"wl-login-info"},rt={class:"wl-avatar"},lt=["title"],at=["src"],it=["textContent"],st={class:"wl-panel"},ct=["for","textContent"],ut=["id","name","type","onUpdate:modelValue"],mt=["placeholder"],dt={class:"wl-preview"},pt=f("hr",null,null,-1),vt=["innerHTML"],gt={class:"wl-footer"},ft={class:"wl-actions"},ht={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},wt=["title"],yt=["title"],bt=["title"],kt={class:"wl-info"},Ct={class:"wl-text-number"},$t={key:0},It=S("  /  "),Lt=["textContent"],jt=["textContent"],St=["disabled"],Rt={key:0,class:"wl-tab-wrapper"},xt=["title","onClick"],Et=["src","alt"],At={key:0,class:"wl-tabs"},Ut=["onClick"],zt=["src","alt","title"],Mt=["title"];tt.render=function(e,t,n,o,r,l){const a=p("CloseIcon"),i=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("ImageIcon"),u=p("PreviewIcon"),m=p("LoadingIcon");return v(),g("div",nt,["disable"!==e.config.login&&e.isLogin?(v(),g("div",ot,[f("div",rt,[f("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[h(a,{size:14})],8,lt),f("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,at)]),f("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:w(e.userInfo.display_name)},null,8,it)])):y("v-if",!0),f("div",st,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(v(),g("div",{key:0,class:b(["wl-header",`item${e.config.meta.length}`])},[(v(!0),g(k,null,C(e.config.meta,(t=>(v(),g("div",{class:"wl-header-item",key:t},[f("label",{for:t,textContent:w(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,ct),$(f("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:b(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,ut),[[I,e.userMeta[t]]])])))),128))],2)):y("v-if",!0),$(f("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,mt),[[L,e.editor]]),$(f("div",dt,[pt,f("h4",null,w(e.locale.preview)+":",1),f("div",{class:"wl-content",innerHTML:e.previewText},null,8,vt)],512),[[j,e.showPreview]]),f("div",gt,[f("div",ft,[f("a",ht,[h(i)]),$(f("button",{ref:"emojiButtonRef",class:b(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[h(s)],10,wt),[[j,e.config.emoji.length]]),f("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[7]||(t[7]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(v(),g("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[h(c)],8,yt)):y("v-if",!0),f("button",{class:b(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[8]||(t[8]=t=>e.showPreview=!e.showPreview)},[h(u)],10,bt)]),f("div",kt,[f("div",Ct,[S(w(e.wordNumber)+" ",1),e.config.wordLimit?(v(),g("span",$t,[It,f("span",{class:b({illegal:!e.isWordNumberLegal}),textContent:w(e.wordLimit)},null,10,Lt)])):y("v-if",!0),S("  "+w(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?y("v-if",!0):(v(),g("button",{key:0,class:"wl-btn",onClick:t[9]||(t[9]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:w(e.locale.login)},null,8,jt)),"force"!==e.config.login||e.isLogin?(v(),g("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[10]||(t[10]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(v(),R(m,{key:0,size:16})):(v(),g(k,{key:1},[S(w(e.locale.submit),1)],2112))],8,St)):y("v-if",!0)]),f("div",{ref:"emojiPopupRef",class:b(["wl-emoji-popup",{display:e.showEmoji}])},[(v(!0),g(k,null,C(e.emoji.tabs,((t,n)=>(v(),g(k,{key:t.name},[n===e.emojiTabIndex?(v(),g("div",Rt,[(v(!0),g(k,null,C(t.items,(t=>(v(),g("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(v(),g("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Et)):y("v-if",!0)],8,xt)))),128))])):y("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(v(),g("div",At,[(v(!0),g(k,null,C(e.emoji.tabs,((t,n)=>(v(),g("button",{key:t.name,class:b(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[f("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,zt)],10,Ut)))),128))])):y("v-if",!0)],2)])]),e.replyId?(v(),g("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[11]||(t[11]=t=>e.$emit("cancel-reply"))},[h(a,{size:24})],8,Mt)):y("v-if",!0)])},tt.__file="src/components/CommentBox.vue";var Ot=c({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:tt,ReplyIcon:()=>s("svg",{viewBox:"0 0 1024 1024",width:"18",height:"18"},s("path",{d:"M1019.2 720C1001.6 625.6 968 566.4 904 497.6c-89.6-89.6-214.4-150.4-347.2-176v-120c0-25.6-8-51.2-25.6-64-33.6-30.4-81.6-30.4-112-4.8L33.6 441.6C12.8 459.2 0 484.8 0 510.4c0 25.6 12.8 51.2 30.4 68.8l385.6 312c17.6 12.8 33.6 17.6 51.2 17.6 12.8 0 25.6-4.8 38.4-8C536 888 552 857.6 552 824v-99.2c124.8 20.8 248 86.4 339.2 140.8 25.6 17.6 59.2 17.6 89.6 0 25.6-17.6 43.2-46.4 43.2-76.8 0-33.6 0-56-4.8-68.8zm-500.8-89.6-46.4-4.8v193.6L86.4 510.4 472 201.6V400l38.4 4.8c128 12.8 248 68.8 334.4 153.6 51.2 56 76.8 102.4 94.4 179.2 0 4.8 4.8 20.8 4.8 51.2C835.2 720 672 640 518.4 630.4z",fill:"currentColor"})),VerifiedIcon:()=>s("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},s("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"}))},emits:["submit","reply"],setup(e){const t=u("config"),n=i((()=>t.value.locale)),o=i((()=>{let{link:t}=e.comment;return t?Ee(t)?t:`https://${t}`:""})),r=Xe(e.comment.insertedAt,n.value),l=i((()=>{var t;return e.comment.objectId===(null===(t=e.reply)||void 0===t?void 0:t.objectId)}));return{config:t,locale:n,isReplyingCurrent:l,link:o,time:r}}});const Pt=["id"],Nt={class:"wl-user","aria-hidden":"true"},Tt=["src"],_t={class:"wl-card"},Bt={class:"wl-head"},Ft=["href"],Dt={key:1,class:"wl-nick"},qt=["textContent"],Ht=["textContent"],Wt=["textContent"],Vt=["title"],Jt={class:"wl-meta","aria-hidden":"true"},Kt=["textContent"],Yt=["textContent"],Gt=["innerHTML"],Xt={key:0,class:"wl-reply-wrapper"},Qt={key:1,class:"wl-quote"};Ot.render=function(e,t,n,o,r,l){const a=p("VerifiedIcon"),i=p("ReplyIcon"),s=p("CommentBox"),c=p("CommentCard",!0);return v(),g("div",{class:"wl-item",id:e.comment.objectId},[f("div",Nt,[e.comment.avatar?(v(),g("img",{key:0,src:e.comment.avatar},null,8,Tt)):y("v-if",!0),e.comment.type?(v(),R(a,{key:1})):y("v-if",!0)]),f("div",_t,[f("div",Bt,[e.link?(v(),g("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},w(e.comment.nick),9,Ft)):(v(),g("span",Dt,w(e.comment.nick),1)),"administrator"===e.comment.type?(v(),g("span",{key:2,class:"wl-badge",textContent:w(e.locale.admin)},null,8,qt)):y("v-if",!0),e.comment.sticky?(v(),g("span",{key:3,class:"wl-badge",textContent:w(e.locale.sticky)},null,8,Ht)):y("v-if",!0),f("span",{class:"wl-time",textContent:w(e.time)},null,8,Wt),f("button",{class:b(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[0]||(t[0]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[h(i)],10,Vt)]),f("div",Jt,[e.comment.browser?(v(),g("span",{key:0,textContent:w(e.comment.browser)},null,8,Kt)):y("v-if",!0),e.comment.os?(v(),g("span",{key:1,textContent:w(e.comment.os)},null,8,Yt)):y("v-if",!0)]),f("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,Gt),e.isReplyingCurrent?(v(),g("div",Xt,[h(s,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[1]||(t[1]=t=>e.$emit("submit",t)),onCancelReply:t[2]||(t[2]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):y("v-if",!0),e.comment.children?(v(),g("div",Qt,[(v(!0),g(k,null,C(e.comment.children,(n=>(v(),R(c,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[3]||(t[3]=t=>e.$emit("reply",t)),onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t))},null,8,["comment","reply","rootId"])))),128))])):y("v-if",!0)])],8,Pt)},Ot.__file="src/components/CommentCard.vue";var Zt=c({name:"WalineRoot",components:{CommentBox:tt,CommentCard:Ot,LoadingIcon:et},props:{serverURL:{type:String,required:!0},path:{type:String,required:!0},meta:{type:Array},requiredMeta:{type:Array},dark:{type:[String,Boolean]},lang:{type:String},locale:{type:Object},pageSize:{type:Number},wordLimit:{type:[Number,Array]},emoji:{type:Array},login:{type:String},highlighter:{type:Function},imageUploader:{type:[Function,Boolean]},texRenderer:{type:[Function,Boolean]}},setup(t){const n=i((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:r=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:l=["nick","mail","link"],requiredMeta:a=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:p=!0,login:v="enable",...g})=>({serverURL:Ae(e),path:Re(t),locale:{...G[n]||G["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Ue(c),meta:T(l),requiredMeta:T(a),imageUploader:ze(u,B),highlighter:ze(m,P),texRenderer:ze(d,F),lang:n,dark:i,emoji:r,pageSize:s,login:v,copyright:p,...g}))(t))),r=Qe(),l=e("loading"),a=e(0),s=e(1),c=e(0),u=e([]),d=e(null),p=i((()=>{return"string"==typeof(e=n.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Me}}`:`${e}${Me}`:!0===e?`:root${Me}`:"";var e}));let v,g;const f=e=>{var t;const{serverURL:o,path:i,pageSize:m}=n.value,d=new AbortController;l.value="loading",null==v||v(),(({serverURL:e,path:t,page:n,pageSize:o,signal:r,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?path=${encodeURIComponent(t)}&pageSize=${o}&page=${n}`,{signal:r,headers:a}).then((e=>e.json())).then((e=>_e(e,"comment list")))})({serverURL:o,path:i,pageSize:m,page:e,signal:d.signal,token:null===(t=r.value)||void 0===t?void 0:t.token}).then((t=>{l.value="success",a.value=t.count,u.value.push(...t.data),s.value=e,c.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),l.value="error")})),v=d.abort.bind(d)},h=()=>{a.value=0,u.value=[],f(1)};return x("config",n),o((()=>t.path),h),m((()=>{var e;h();const t=document.createElement("style");t.innerText=p.value,null===(e=document.querySelector("[data-waline]"))||void 0===e||e.appendChild(t),g=E((()=>{t.innerText=p.value}))})),A((()=>g())),{config:n,darkmodeStyle:p,i18n:i((()=>n.value.locale)),status:l,count:a,page:s,totalPages:c,data:u,reply:d,loadMore:()=>f(s.value+1),refresh:h,onReply:e=>{d.value=e},onSubmit:e=>{if(e.rid){const t=u.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else u.value.unshift(e)},version:"2.0.7"}}});const en={"data-waline":""},tn={class:"wl-count"},nn=["textContent"],on={class:"wl-cards"},rn={key:1,class:"wl-operation"},ln=["textContent"],an={key:0,class:"wl-loading"},sn=["textContent"],cn={class:"wl-operation"},un=["textContent"],mn={key:3,class:"wl-power"},dn=S(" Powered by "),pn=f("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);Zt.render=function(e,t,n,o,r,l){const a=p("CommentBox"),i=p("CommentCard"),s=p("LoadingIcon");return v(),g("div",en,[e.reply?y("v-if",!0):(v(),R(a,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),f("div",tn,[e.count?(v(),g("span",{key:0,class:"wl-num",textContent:w(e.count)},null,8,nn)):y("v-if",!0),S(" "+w(e.i18n.comment),1)]),f("div",on,[(v(!0),g(k,null,C(e.data,(t=>(v(),R(i,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit},null,8,["root-id","comment","reply","onReply","onSubmit"])))),128))]),"error"===e.status?(v(),g("div",rn,[f("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:w(e.i18n.refresh)},null,8,ln)])):(v(),g(k,{key:2},["loading"===e.status?(v(),g("div",an,[h(s,{size:30})])):e.data.length?e.page<e.totalPages?(v(),g(k,{key:2},[y(" Load more button "),f("div",cn,[f("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:w(e.i18n.more)},null,8,un)])],2112)):y("v-if",!0):(v(),g("div",{key:1,class:"wl-empty",textContent:w(e.i18n.sofa)},null,8,sn))],2112)),y(" Copyright Information "),e.config.copyright?(v(),g("div",mn,[dn,pn,S(" v"+w(e.version),1)])):y("v-if",!0)])},Zt.__file="src/components/Waline.vue";const vn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},gn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0})=>{const r=new AbortController,l=Array.from(document.querySelectorAll(n)),a=e=>{const n=Ge(e);return null!==n&&t!==n},i=n=>Be({serverURL:e,paths:n.map((e=>Ge(e)||t)),signal:r.signal}).then((e=>vn(e,n))).catch(Te);if(o){const n=l.filter((e=>!a(e))),o=l.filter(a);Fe({serverURL:e,path:t}).then((e=>vn(new Array(n.length).fill(e),n))),o.length&&i(o)}else i(l);return r.abort.bind(r)},fn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:o=!1,...r})=>{const l=e?De(e):null;if(e&&!l)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const a=U({...r}),i=U({comment:n,pageview:o,path:t}),c=()=>{i.comment&&Ze({serverURL:a.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})},u=()=>{i.pageview&&gn({serverURL:a.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})},m=l?z((()=>s(Zt,{path:i.path,...a}))):null;m&&m.mount(l),c(),u();const d=E(c),p=E(u);return{el:l,update:({comment:e,pageview:t,path:n=window.location.pathname,...o})=>{Object.entries(o).forEach((([e,t])=>{a[e]=t})),i.path=n,void 0!==e&&(i.comment=e),void 0!==t&&(i.pageview=t)},destroy:()=>{null==m||m.unmount(),d(),p()}}},hn="2.0.7",wn=({el:e,serverURL:t,count:n})=>{var o;const r=Qe(),l=De(e),a=new AbortController;return(({serverURL:e,count:t,signal:n,token:o})=>{const r={};return o&&(r.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=recent&count=${t}`,{signal:n,headers:r}).then((e=>e.json())).then((e=>_e(e,"recent comment")))})({serverURL:t,count:n,signal:a.signal,token:null===(o=r.value)||void 0===o?void 0:o.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:()=>{a.abort(),l.innerHTML=""}}):{comments:e,destroy:()=>a.abort()}))};export{wn as RecentComments,Ze as commentCount,_ as defaultLang,F as defaultTexRenderer,B as defaultUploadImage,T as getMeta,fn as init,G as locales,gn as pageviewCount,hn as version};
1
+ import{getCurrentScope as e,onScopeDispose as t,ref as n,unref as o,isRef as r,watch as l,readonly as a,shallowRef as i,computed as s,h as c,defineComponent as u,inject as m,onMounted as d,onUnmounted as p,resolveComponent as v,openBlock as g,createElementBlock as f,createElementVNode as h,createVNode as w,toDisplayString as y,createCommentVNode as b,normalizeClass as k,Fragment as C,renderList as $,withDirectives as I,vModelDynamic as L,vModelText as j,vShow as S,createTextVNode as R,createBlock as x,provide as E,reactive as A,createApp as U,watchEffect as z}from"vue";import M from"autosize";import{marked as O}from"marked";import P from"hanabi";const N=["nick","mail","link"],T=e=>e.filter((e=>N.includes(e))),_="zh-CN",B=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>{var e;return t((null===(e=o.result)||void 0===e?void 0:e.toString())||"")},o.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>',F=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","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"],H=e=>Object.fromEntries(e.map(((e,t)=>[F[t],e])));var W=H(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","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"]),q=H(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),V=H(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),J=H(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),K=H(["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","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"]),Y=H(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const G={zh:V,"zh-cn":V,"zh-CN":V,"zh-tw":J,"zh-TW":J,en:W,"en-US":W,"en-us":W,jp:q,"jp-jp":q,"jp-JP":q,"pt-br":K,"pt-BR":K,ru:Y,"ru-ru":Y,"ru-RU":Y};function X(n){return!!e()&&(t(n),!0)}const Q="undefined"!=typeof window,Z=()=>{};const ee=e=>e();var te=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;function re(e,t,n={}){const o=n,{eventFilter:r=ee}=o,a=((e,t)=>{var n={};for(var o in e)ne.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&te)for(var o of te(e))t.indexOf(o)<0&&oe.call(e,o)&&(n[o]=e[o]);return n})(o,["eventFilter"]);return l(e,(i=r,s=t,function(...e){i((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),a);var i,s}var le=Object.defineProperty,ae=Object.defineProperties,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,me=(e,t,n)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function de(e,t,o={}){const r=o,{eventFilter:l}=r,a=((e,t)=>{var n={};for(var o in e)ce.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&se)for(var o of se(e))t.indexOf(o)<0&&ue.call(e,o)&&(n[o]=e[o]);return n})(r,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(e=ee){const t=n(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(l),m=re(e,t,(d=((e,t)=>{for(var n in t||(t={}))ce.call(t,n)&&me(e,n,t[n]);if(se)for(var n of se(t))ue.call(t,n)&&me(e,n,t[n]);return e})({},a),ae(d,ie({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const pe=Q?window:void 0,ve=Q?window.document:void 0;function ge(...e){let t,n,r,a;if("string"==typeof e[0]?([n,r,a]=e,t=pe):[t,n,r,a]=e,!t)return Z;let i=Z;const s=l((()=>function(e){var t;const n=o(e);return null!=(t=null==n?void 0:n.$el)?t:n}(t)),(e=>{i(),e&&(e.addEventListener(n,r,a),i=()=>{e.removeEventListener(n,r,a),i=Z})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return X(c),c}Q&&window.navigator,Q&&window.location;const fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},he="__vueuse_ssr_handlers__";fe[he]=fe[he]||{};const we=fe[he];const ye={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function be(e,t,r,l={}){var a;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:p=pe,eventFilter:v,onError:g=(e=>{console.error(e)})}=l,f=(d?i:n)(t);if(!r)try{r=function(e,t){return we[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=pe)?void 0:e.localStorage}))()}catch(e){g(e)}if(!r)return f;const h=o(t),w=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e||Array.isArray(e)?"object":Number.isNaN(e)?"any":"number"}(h),y=null!=(a=l.serializer)?a:ye[w],{pause:b,resume:k}=de(f,(()=>function(t){try{null==t?r.removeItem(e):r.setItem(e,y.write(t))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:v});return p&&u&&ge(p,"storage",C),C(),f;function C(t){t&&t.key!==e||(f.value=function(t){if(!t||t.key===e){b();try{const n=t?t.newValue:r.getItem(e);return null==n?(m&&null!==h&&r.setItem(e,y.write(h)),h):"string"!=typeof n?n:y.read(n)}catch(e){g(e)}finally{k()}}}(t))}}var ke,Ce,$e=Object.defineProperty,Ie=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Se=(e,t,n)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Re(e={}){const{controls:t=!1,interval:a="requestAnimationFrame"}=e,i=n(new Date),s=()=>i.value=new Date,c="requestAnimationFrame"===a?function(e,t={}){const{immediate:o=!0,window:r=pe}=t,l=n(!1);let a=null;function i(){l.value&&r&&(e(),a=r.requestAnimationFrame(i))}function s(){!l.value&&r&&(l.value=!0,i())}function c(){l.value=!1,null!=a&&r&&(r.cancelAnimationFrame(a),a=null)}return o&&s(),X(c),{isActive:l,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,a={}){const{immediate:i=!0,immediateCallback:s=!1}=a;let c=null;const u=n(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function p(){t<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,o(t)))}i&&Q&&p(),r(t)&&X(l(t,(()=>{i&&Q&&p()})));return X(d),{isActive:u,pause:d,resume:p}}(s,a,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))Le.call(t,n)&&Se(e,n,t[n]);if(Ie)for(var n of Ie(t))je.call(t,n)&&Se(e,n,t[n]);return e})({now:i},c):i}Q&&(null==window?void 0:window.navigator)&&(null==(ke=null==window?void 0:window.navigator)?void 0:ke.platform)&&/iP(ad|hone|od)/.test(null==(Ce=null==window?void 0:window.navigator)?void 0:Ce.platform);let xe=0;const Ee=e=>{try{e=decodeURI(e)}catch(e){}return e},Ae=(e="")=>e.replace(/\/$/u,""),Ue=e=>/^(https?:)?\/\//.test(e),ze=e=>{const t=Ae(e);return Ue(t)?t:`https://${t}`},Me=e=>Array.isArray(e)?e:!!e&&[0,e],Oe=(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}",Ne=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Te=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,r=t.getTime()-o.getTime(),l=Math.floor(r/864e5);if(0===l){const e=r%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return l<0?n.now:l<8?`${l} ${n.days}`:(e=>{const t=Ne(e.getDate(),2),n=Ne(e.getMonth()+1,2);return`${Ne(e.getFullYear(),2)}-${n}-${t}`})(o)},_e=e=>{const t=be("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((o=>{const r={folder:e,...o};return n&&(t.value[e]=r),r}))},Be=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,De=e=>{"AbortError"!==e.name&&console.error(e.message)},Fe=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},He=({serverURL:e,paths:t,signal:n})=>fetch(`${e}/article?path=${encodeURIComponent(t.join(","))}`,{signal:n}).then((e=>e.json())).then((e=>Fe(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),We=({serverURL:e,path:t})=>fetch(`${e}/article`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}).then((e=>e.json())).then((e=>Fe(e,"visit count"))),qe=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Ve=e=>e.type.includes("image"),Je=e=>{const t=Array.from(e).find(Ve);return t?t.getAsFile():null},Ke=/\$.*?\$/,Ye=/^\$(.*?)\$/,Ge=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Xe=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),Qe=(e,{emojiMap:t,highlighter:n,texRenderer:o})=>{if(O.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),o){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=Ge.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(Ke);return-1!==t?t:e.length},tokenizer(t){const n=Ye.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);O.use({extensions:e})}return O.parse(Xe(e,t))},Ze=e=>e.dataset.path||e.getAttribute("id"),et=()=>be("USER_KEY",{}),tt=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count"})=>{var o;const r=new AbortController,l=document.querySelectorAll(n),a=et();return l.length&&(({serverURL:e,paths:t,signal:n,token:o})=>{const r={};return o&&(r.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(t.join(","))}`,{signal:n,headers:r}).then((e=>e.json())).then((e=>Fe(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(l).map((e=>Ee(e.dataset.path||e.getAttribute("id")||t))),signal:r.signal,token:null===(o=a.value)||void 0===o?void 0:o.token}).then((e=>{l.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(De),r.abort.bind(r)},nt=({size:e})=>c("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},c("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},c("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var ot=u({name:"CommentBox",components:{CloseIcon:({size:e})=>c("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[c("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"}),c("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:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("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:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("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"}),c("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"})]),MarkdownIcon:()=>c("svg",{width:"16",height:"16",ariaHidden:"true"},c("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:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("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"}),c("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},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""}},emits:["submit","cancel-reply"],setup(e,{emit:t}){const o=m("config"),r=be("WALINE_COMMENT_BOX_EDITOR",""),a=be("WALINE_USER_META",{nick:"",mail:"",link:""}),i=et(),c=n({}),u=n(null),v=n(null),g=n(null),f=n(null),h=n({tabs:[],map:{}}),w=n(0),y=n(!1),b=n(!1),k=n(""),C=n(0),$=n(0),I=n(!1),L=n(""),j=n(!1),S=s((()=>o.value.locale)),R=s((()=>{var e;return Boolean(null===(e=i.value)||void 0===e?void 0:e.token)})),x=s((()=>!1!==o.value.imageUploader)),E=e=>{const t=u.value,n=t.selectionStart,o=t.selectionEnd||0,l=t.scrollTop;r.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=l},A=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return E(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)}))},U=()=>{var n,l,s,m,d;const{serverURL:p,lang:v,login:g,wordLimit:f,requiredMeta:w}=o.value,y={comment:L.value,nick:a.value.nick,mail:a.value.mail,link:a.value.link,ua:navigator.userAgent,url:o.value.path};if(null===(n=i.value)||void 0===n?void 0:n.token)y.nick=i.value.display_name,y.mail=i.value.email,y.link=i.value.url;else{if("force"===g)return;if(w.indexOf("nick")>-1&&!y.nick)return null===(l=c.value.nick)||void 0===l||l.focus(),alert(S.value.nickError);if(w.indexOf("mail")>-1&&!y.mail||y.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.){0,2}\w+$/.exec(y.mail))return null===(s=c.value.mail)||void 0===s||s.focus(),alert(S.value.mailError);if(!y.comment)return void(null===(m=u.value)||void 0===m||m.focus());y.nick||(y.nick=S.value.anonymous)}if(!I.value)return alert(S.value.wordHint.replace("$0",f[0].toString()).replace("$1",f[1].toString()).replace("$2",C.value.toString()));y.comment=Xe(y.comment,h.value.map),e.replyId&&e.rootId&&(y.pid=e.replyId,y.rid=e.rootId,y.at=e.replyUser),j.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const r={"Content-Type":"application/json"};return n&&(r.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:p,lang:v,token:null===(d=i.value)||void 0===d?void 0:d.token,comment:y}).then((n=>{if(j.value=!1,n.errmsg)return alert(n.errmsg);t("submit",n.data),r.value="",k.value="",e.replyId&&t("cancel-reply")})).catch((e=>{j.value=!1,alert(e.message)}))},z=e=>{g.value.contains(e.target)||f.value.contains(e.target)||(y.value=!1)};return l([o,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?($.value=n[0],I.value=!1):t>n[1]?($.value=n[1],I.value=!1):($.value=n[1],I.value=!0):($.value=0,I.value=!0)}),{immediate:!0}),d((()=>{document.body.addEventListener("click",z),l((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;L.value=e,k.value=Qe(e,{emojiMap:h.value.map,highlighter:t,texRenderer:n}),C.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?M(u.value):M.destroy(u.value)}),{immediate:!0}),l((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?_e(Ae(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:r,prefix:l,type:a,items:i}=e;t.tabs.push({name:n,icon:Be(r,o,l,a),items:i.map((e=>{const n=`${l||""}${e}`;return t.map[n]=Be(e,o,l,a),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),p((()=>{document.body.removeEventListener("click",z)})),{config:o,locale:S,insert:E,onChange:()=>{const e=v.value;e.files&&x.value&&A(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{var t;if(null===(t=e.dataTransfer)||void 0===t?void 0:t.items){const t=Je(e.dataTransfer.items);t&&x.value&&(A(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&U()},onPaste:e=>{if(e.clipboardData){const t=Je(e.clipboardData.items);t&&x.value&&A(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,r=(window.innerWidth-450)/2,l=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${r},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);null==a||a.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(null==a||a.close(),i.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",s))};window.addEventListener("message",s)},onLogout:()=>{i.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,r=(window.innerWidth-800)/2,l=(window.innerHeight-800)/2,a=window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${r},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);null==a||a.postMessage({type:"TOKEN",data:i.value.token},"*");const s=({data:e})=>{e&&"profile"===e.type&&(i.value={...i.value,...e},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(i)))),window.removeEventListener("message",s))};window.addEventListener("message",s)},submitComment:U,isLogin:R,userInfo:i,isSubmitting:j,wordNumber:C,wordLimit:$,isWordNumberLegal:I,editor:r,userMeta:a,emoji:h,emojiTabIndex:w,showEmoji:y,canUploadImage:x,previewText:k,showPreview:b,inputRefs:c,editorRef:u,emojiButtonRef:g,emojiPopupRef:f,imageUploadRef:v}}});const rt={class:"wl-comment"},lt={key:0,class:"wl-login-info"},at={class:"wl-avatar"},it=["title"],st=["src"],ct=["textContent"],ut={class:"wl-panel"},mt=["for","textContent"],dt=["id","name","type","onUpdate:modelValue"],pt=["placeholder"],vt={class:"wl-preview"},gt=h("hr",null,null,-1),ft=["innerHTML"],ht={class:"wl-footer"},wt={class:"wl-actions"},yt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},bt=["title"],kt=["title"],Ct=["title"],$t={class:"wl-info"},It={class:"wl-text-number"},Lt={key:0},jt=R("  /  "),St=["textContent"],Rt=["textContent"],xt=["disabled"],Et={key:0,class:"wl-tab-wrapper"},At=["title","onClick"],Ut=["src","alt"],zt={key:0,class:"wl-tabs"},Mt=["onClick"],Ot=["src","alt","title"],Pt=["title"];ot.render=function(e,t,n,o,r,l){const a=v("CloseIcon"),i=v("MarkdownIcon"),s=v("EmojiIcon"),c=v("ImageIcon"),u=v("PreviewIcon"),m=v("LoadingIcon");return g(),f("div",rt,["disable"!==e.config.login&&e.isLogin?(g(),f("div",lt,[h("div",at,[h("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[w(a,{size:14})],8,it),h("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,st)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",onClick:t[1]||(t[1]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:y(e.userInfo.display_name)},null,8,ct)])):b("v-if",!0),h("div",ut,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(g(),f("div",{key:0,class:k(["wl-header",`item${e.config.meta.length}`])},[(g(!0),f(C,null,$(e.config.meta,(t=>(g(),f("div",{class:"wl-header-item",key:t},[h("label",{for:t,textContent:y(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,mt),I(h("input",{ref_for:!0,ref:n=>{n&&(e.inputRefs[t]=n)},id:`wl-${t}`,class:k(["wl-input",`wl-${t}`]),name:t,type:"mail"===t?"email":"text","onUpdate:modelValue":n=>e.userMeta[t]=n},null,10,dt),[[L,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),I(h("textarea",{class:"wl-editor",ref:"editorRef",id:"wl-edit",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editor=t),onKeydown:t[3]||(t[3]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:t[4]||(t[4]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:t[5]||(t[5]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,pt),[[j,e.editor]]),I(h("div",vt,[gt,h("h4",null,y(e.locale.preview)+":",1),h("div",{class:"wl-content",innerHTML:e.previewText},null,8,ft)],512),[[S,e.showPreview]]),h("div",ht,[h("div",wt,[h("a",yt,[w(i)]),I(h("button",{ref:"emojiButtonRef",class:k(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:t[6]||(t[6]=t=>e.showEmoji=!e.showEmoji)},[w(s)],10,bt),[[S,e.emoji.tabs.length]]),h("input",{ref:"imageUploadRef",class:"upload",id:"wl-image-upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:t[7]||(t[7]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(g(),f("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[w(c)],8,kt)):b("v-if",!0),h("button",{class:k(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:t[8]||(t[8]=t=>e.showPreview=!e.showPreview)},[w(u)],10,Ct)]),h("div",$t,[h("div",It,[R(y(e.wordNumber)+" ",1),e.config.wordLimit?(g(),f("span",Lt,[jt,h("span",{class:k({illegal:!e.isWordNumberLegal}),textContent:y(e.wordLimit)},null,10,St)])):b("v-if",!0),R("  "+y(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(g(),f("button",{key:0,class:"wl-btn",onClick:t[9]||(t[9]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:y(e.locale.login)},null,8,Rt)),"force"!==e.config.login||e.isLogin?(g(),f("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:t[10]||(t[10]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(g(),x(m,{key:0,size:16})):(g(),f(C,{key:1},[R(y(e.locale.submit),1)],2112))],8,xt)):b("v-if",!0)]),h("div",{ref:"emojiPopupRef",class:k(["wl-emoji-popup",{display:e.showEmoji}])},[(g(!0),f(C,null,$(e.emoji.tabs,((t,n)=>(g(),f(C,{key:t.name},[n===e.emojiTabIndex?(g(),f("div",Et,[(g(!0),f(C,null,$(t.items,(t=>(g(),f("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(g(),f("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ut)):b("v-if",!0)],8,At)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(g(),f("div",zt,[(g(!0),f(C,null,$(e.emoji.tabs,((t,n)=>(g(),f("button",{key:t.name,class:k(["wl-tab",{active:e.emojiTabIndex===n}]),onClick:t=>e.emojiTabIndex=n},[h("img",{class:"wl-emoji",src:t.icon,alt:t.name,title:t.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ot)],10,Mt)))),128))])):b("v-if",!0)],2)])]),e.replyId?(g(),f("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[11]||(t[11]=t=>e.$emit("cancel-reply"))},[w(a,{size:24})],8,Pt)):b("v-if",!0)])},ot.__file="src/components/CommentBox.vue";var Nt=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:ot,ReplyIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"18",height:"18"},c("path",{d:"M1019.2 720C1001.6 625.6 968 566.4 904 497.6c-89.6-89.6-214.4-150.4-347.2-176v-120c0-25.6-8-51.2-25.6-64-33.6-30.4-81.6-30.4-112-4.8L33.6 441.6C12.8 459.2 0 484.8 0 510.4c0 25.6 12.8 51.2 30.4 68.8l385.6 312c17.6 12.8 33.6 17.6 51.2 17.6 12.8 0 25.6-4.8 38.4-8C536 888 552 857.6 552 824v-99.2c124.8 20.8 248 86.4 339.2 140.8 25.6 17.6 59.2 17.6 89.6 0 25.6-17.6 43.2-46.4 43.2-76.8 0-33.6 0-56-4.8-68.8zm-500.8-89.6-46.4-4.8v193.6L86.4 510.4 472 201.6V400l38.4 4.8c128 12.8 248 68.8 334.4 153.6 51.2 56 76.8 102.4 94.4 179.2 0 4.8 4.8 20.8 4.8 51.2C835.2 720 672 640 518.4 630.4z",fill:"currentColor"})),VerifiedIcon:()=>c("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},c("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"}))},emits:["submit","reply"],setup(e){const t=m("config"),n=s((()=>t.value.locale)),o=s((()=>{let{link:t}=e.comment;return t?Ue(t)?t:`https://${t}`:""})),r=((e,t)=>{const n=Re();return s((()=>Te(e,n.value,t)))})(e.comment.insertedAt,n.value),l=s((()=>{var t;return e.comment.objectId===(null===(t=e.reply)||void 0===t?void 0:t.objectId)}));return{config:t,locale:n,isReplyingCurrent:l,link:o,time:r}}});const Tt=["id"],_t={class:"wl-user","aria-hidden":"true"},Bt=["src"],Dt={class:"wl-card"},Ft={class:"wl-head"},Ht=["href"],Wt={key:1,class:"wl-nick"},qt=["textContent"],Vt=["textContent"],Jt=["textContent"],Kt=["textContent"],Yt=["title"],Gt={class:"wl-meta","aria-hidden":"true"},Xt=["textContent"],Qt=["textContent"],Zt=["innerHTML"],en={key:0,class:"wl-reply-wrapper"},tn={key:1,class:"wl-quote"};Nt.render=function(e,t,n,o,r,l){const a=v("VerifiedIcon"),i=v("ReplyIcon"),s=v("CommentBox"),c=v("CommentCard",!0);return g(),f("div",{class:"wl-item",id:e.comment.objectId},[h("div",_t,[e.comment.avatar?(g(),f("img",{key:0,src:e.comment.avatar},null,8,Bt)):b("v-if",!0),e.comment.type?(g(),x(a,{key:1})):b("v-if",!0)]),h("div",Dt,[h("div",Ft,[e.link?(g(),f("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},y(e.comment.nick),9,Ht)):(g(),f("span",Wt,y(e.comment.nick),1)),"administrator"===e.comment.type?(g(),f("span",{key:2,class:"wl-badge",textContent:y(e.locale.admin)},null,8,qt)):b("v-if",!0),e.comment.sticky?(g(),f("span",{key:3,class:"wl-badge",textContent:y(e.locale.sticky)},null,8,Vt)):b("v-if",!0),e.comment.level>=0?(g(),f("span",{key:4,class:"wl-badge",textContent:y(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,8,Jt)):b("v-if",!0),h("span",{class:"wl-time",textContent:y(e.time)},null,8,Kt),h("button",{class:k(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:t[0]||(t[0]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[w(i)],10,Yt)]),h("div",Gt,[e.comment.browser?(g(),f("span",{key:0,textContent:y(e.comment.browser)},null,8,Xt)):b("v-if",!0),e.comment.os?(g(),f("span",{key:1,textContent:y(e.comment.os)},null,8,Qt)):b("v-if",!0)]),h("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,Zt),e.isReplyingCurrent?(g(),f("div",en,[w(s,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[1]||(t[1]=t=>e.$emit("submit",t)),onCancelReply:t[2]||(t[2]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(g(),f("div",tn,[(g(!0),f(C,null,$(e.comment.children,(n=>(g(),x(c,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[3]||(t[3]=t=>e.$emit("reply",t)),onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,Tt)},Nt.__file="src/components/CommentCard.vue";var nn=u({name:"WalineRoot",components:{CommentBox:ot,CommentCard:Nt,LoadingIcon:nt},props:{serverURL:{type:String,required:!0},path:{type:String,required:!0},meta:{type:Array},requiredMeta:{type:Array},dark:{type:[String,Boolean]},lang:{type:String},locale:{type:Object},pageSize:{type:Number},wordLimit:{type:[Number,Array]},emoji:{type:[Array,Boolean]},login:{type:String},highlighter:{type:Function},imageUploader:{type:[Function,Boolean]},texRenderer:{type:[Function,Boolean]}},setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:r=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:l=["nick","mail","link"],requiredMeta:a=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:p=!0,login:v="enable",...g})=>({serverURL:ze(e),path:Ee(t),locale:{...G[n]||G["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Me(c),meta:T(l),requiredMeta:T(a),imageUploader:Oe(u,B),highlighter:Oe(m,P),texRenderer:Oe(d,D),lang:n,dark:i,emoji:r,pageSize:s,login:v,copyright:p,...g}))(e))),o=et(),r=n("loading"),i=n(0),c=n(1),u=n(0),m=n([]),p=n(null),v=s((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Pe}}`:`${e}${Pe}`:!0===e?`:root${Pe}`:"";var e}));let g;!function(e,t={}){const o=n(!1),{document:r=ve,immediate:i=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++xe}=t,u=n(e);let m=()=>{};const d=()=>{if(!r)return;const e=r.getElementById(c)||r.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),r.head.appendChild(e),o.value||(m=l(u,(t=>{e.innerText=t}),{immediate:!0}),o.value=!0)},p=()=>{r&&o.value&&(m(),r.head.removeChild(r.getElementById(c)),o.value=!1)};i&&!s&&d(),s||X(p),a(o)}(v);const f=e=>{var n;const{serverURL:l,path:a,pageSize:s}=t.value,d=new AbortController;r.value="loading",null==g||g(),(({serverURL:e,path:t,page:n,pageSize:o,signal:r,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?path=${encodeURIComponent(t)}&pageSize=${o}&page=${n}`,{signal:r,headers:a}).then((e=>e.json())).then((e=>Fe(e,"comment list")))})({serverURL:l,path:a,pageSize:s,page:e,signal:d.signal,token:null===(n=o.value)||void 0===n?void 0:n.token}).then((t=>{r.value="success",i.value=t.count,m.value.push(...t.data),c.value=e,u.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),g=d.abort.bind(d)},h=()=>{i.value=0,m.value=[],f(1)};return E("config",t),l((()=>e.path),h),d((()=>h())),{config:t,darkmodeStyle:v,i18n:s((()=>t.value.locale)),status:r,count:i,page:c,totalPages:u,data:m,reply:p,loadMore:()=>f(c.value+1),refresh:h,onReply:e=>{p.value=e},onSubmit:e=>{if(e.rid){const t=m.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else m.value.unshift(e)},version:"2.1.0"}}});const on={"data-waline":""},rn={class:"wl-count"},ln=["textContent"],an={class:"wl-cards"},sn={key:1,class:"wl-operation"},cn=["textContent"],un={key:0,class:"wl-loading"},mn=["textContent"],dn={class:"wl-operation"},pn=["textContent"],vn={key:3,class:"wl-power"},gn=R(" Powered by "),fn=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);nn.render=function(e,t,n,o,r,l){const a=v("CommentBox"),i=v("CommentCard"),s=v("LoadingIcon");return g(),f("div",on,[e.reply?b("v-if",!0):(g(),x(a,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),h("div",rn,[e.count?(g(),f("span",{key:0,class:"wl-num",textContent:y(e.count)},null,8,ln)):b("v-if",!0),R(" "+y(e.i18n.comment),1)]),h("div",an,[(g(!0),f(C,null,$(e.data,(t=>(g(),x(i,{key:t.objectId,"root-id":t.objectId,comment:t,reply:e.reply,onReply:e.onReply,onSubmit:e.onSubmit},null,8,["root-id","comment","reply","onReply","onSubmit"])))),128))]),"error"===e.status?(g(),f("div",sn,[h("button",{type:"button",class:"wl-btn",onClick:t[0]||(t[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:y(e.i18n.refresh)},null,8,cn)])):(g(),f(C,{key:2},["loading"===e.status?(g(),f("div",un,[w(s,{size:30})])):e.data.length?e.page<e.totalPages?(g(),f(C,{key:2},[b(" Load more button "),h("div",dn,[h("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:y(e.i18n.more)},null,8,pn)])],2112)):b("v-if",!0):(g(),f("div",{key:1,class:"wl-empty",textContent:y(e.i18n.sofa)},null,8,mn))],2112)),b(" Copyright Information "),e.config.copyright?(g(),f("div",vn,[gn,fn,R(" v"+y(e.version),1)])):b("v-if",!0)])},nn.__file="src/components/Waline.vue";const hn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},wn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0})=>{const r=new AbortController,l=Array.from(document.querySelectorAll(n)),a=e=>{const n=Ze(e);return null!==n&&t!==n},i=n=>He({serverURL:e,paths:n.map((e=>Ze(e)||t)),signal:r.signal}).then((e=>hn(e,n))).catch(De);if(o){const n=l.filter((e=>!a(e))),o=l.filter(a);We({serverURL:e,path:t}).then((e=>hn(new Array(n.length).fill(e),n))),o.length&&i(o)}else i(l);return r.abort.bind(r)},yn=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:o=!1,...r})=>{const l=e?qe(e):null;if(e&&!l)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const a=A({...r}),i=A({comment:n,pageview:o,path:t}),s=()=>{i.comment&&tt({serverURL:a.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})},u=()=>{i.pageview&&wn({serverURL:a.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})},m=l?U((()=>c(nn,{path:i.path,...a}))):null;m&&m.mount(l),s(),u();const d=z(s),p=z(u);return{el:l,update:({comment:e,pageview:t,path:n=window.location.pathname,...o})=>{Object.entries(o).forEach((([e,t])=>{a[e]=t})),i.path=n,void 0!==e&&(i.comment=e),void 0!==t&&(i.pageview=t)},destroy:()=>{null==m||m.unmount(),d(),p()}}},bn="2.1.0",kn=({el:e,serverURL:t,count:n})=>{var o;const r=et(),l=qe(e),a=new AbortController;return(({serverURL:e,count:t,signal:n,token:o})=>{const r={};return o&&(r.Authorization=`Bearer ${o}`),fetch(`${e}/comment?type=recent&count=${t}`,{signal:n,headers:r}).then((e=>e.json())).then((e=>Fe(e,"recent comment")))})({serverURL:t,count:n,signal:a.signal,token:null===(o=r.value)||void 0===o?void 0:o.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:()=>{a.abort(),l.innerHTML=""}}):{comments:e,destroy:()=>a.abort()}))};export{kn as RecentComments,tt as commentCount,_ as defaultLang,D as defaultTexRenderer,B as defaultUploadImage,T as getMeta,yn as init,G as locales,wn as pageviewCount,bn as version};
2
2
  //# sourceMappingURL=shim.esm.js.map