@waline/client 2.3.2 → 2.4.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.
- package/dist/component.esm.js +1 -1
- package/dist/component.esm.js.map +1 -1
- package/dist/component.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/legacy.d.ts +3 -8
- package/dist/legacy.js +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/pageview.cjs.d.ts +47 -0
- package/dist/pageview.cjs.js +1 -1
- package/dist/pageview.cjs.js.map +1 -1
- package/dist/pageview.esm.d.ts +47 -0
- package/dist/pageview.esm.js +1 -1
- package/dist/pageview.esm.js.map +1 -1
- package/dist/pageview.js +1 -1
- package/dist/pageview.js.map +1 -1
- package/dist/shim.d.ts +45 -10
- package/dist/shim.esm.d.ts +45 -10
- package/dist/shim.esm.js +1 -1
- package/dist/shim.esm.js.map +1 -1
- package/dist/shim.js +1 -1
- package/dist/shim.js.map +1 -1
- package/dist/waline.cjs.d.ts +45 -10
- package/dist/waline.cjs.js +1 -1
- package/dist/waline.cjs.js.map +1 -1
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/dist/waline.d.ts +45 -10
- package/dist/waline.esm.d.ts +45 -10
- package/dist/waline.esm.js +1 -1
- package/dist/waline.esm.js.map +1 -1
- package/dist/waline.js +1 -1
- package/dist/waline.js.map +1 -1
- package/package.json +14 -14
- package/src/components/CommentCard.vue +69 -6
- package/src/components/Icons.ts +28 -2
- package/src/components/Waline.vue +93 -2
- package/src/composables/index.ts +1 -0
- package/src/composables/likeStorage.ts +11 -0
- package/src/composables/userInfo.ts +2 -0
- package/src/config/i18n/en.ts +2 -0
- package/src/config/i18n/generate.ts +2 -0
- package/src/config/i18n/jp.ts +2 -0
- package/src/config/i18n/pt-BR.ts +2 -0
- package/src/config/i18n/ru.ts +2 -0
- package/src/config/i18n/vi-VN.ts +2 -0
- package/src/config/i18n/zh-CN.ts +2 -0
- package/src/config/i18n/zh-TW.ts +2 -0
- package/src/styles/card.scss +24 -0
- package/src/typings/comment.ts +56 -1
- package/src/typings/locale.ts +3 -8
- package/src/utils/config.ts +1 -1
- package/src/utils/fetch.ts +77 -4
- package/LICENSE +0 -339
package/dist/shim.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getCurrentScope as e,onScopeDispose as t,ref as n,unref as o,isRef as l,watch as r,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 x,createTextVNode as E,createBlock as R,provide as S,reactive as A,createApp as U,watchEffect as z}from"vue";import M from"autosize";import{marked as O}from"marked";const P=["nick","mail","link"],N=e=>e.filter((e=>P.includes(e))),T=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})),_=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>',B=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),F=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],D={},H=e=>{let t=0;return e.replace(B,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"<";let l;D[n]?l=D[n]:(l=F[t],D[n]=l);const r=`<span style="color: #${l}">${n}</span>`;return t=++t%F.length,r}))},W=["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"],q=e=>Object.fromEntries(e.map(((e,t)=>[W[t],e])));var V=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","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar"]),J=q(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),K=q(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),Y=q(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),G=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"]),X=q(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const Q={zh:K,"zh-cn":K,"zh-CN":K,"zh-tw":Y,"zh-TW":Y,en:V,"en-US":V,"en-us":V,jp:J,"jp-jp":J,"jp-JP":J,"pt-br":G,"pt-BR":G,ru:X,"ru-ru":X,"ru-RU":X};function Z(n){return!!e()&&(t(n),!0)}const ee="undefined"!=typeof window,te=()=>{};const ne=e=>e();var oe=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;function ae(e,t,n={}){const o=n,{eventFilter:l=ne}=o,a=((e,t)=>{var n={};for(var o in e)le.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&oe)for(var o of oe(e))t.indexOf(o)<0&&re.call(e,o)&&(n[o]=e[o]);return n})(o,["eventFilter"]);return r(e,(i=l,s=t,function(...e){i((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),a);var i,s}var ie=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,pe=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function ve(e,t,o={}){const l=o,{eventFilter:r}=l,a=((e,t)=>{var n={};for(var o in e)me.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&ue)for(var o of ue(e))t.indexOf(o)<0&&de.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(e=ne){const t=n(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(r),m=ae(e,t,(d=((e,t)=>{for(var n in t||(t={}))me.call(t,n)&&pe(e,n,t[n]);if(ue)for(var n of ue(t))de.call(t,n)&&pe(e,n,t[n]);return e})({},a),se(d,ce({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const ge=ee?window:void 0,fe=ee?window.document:void 0;function he(...e){let t,n,l,a;if("string"==typeof e[0]?([n,l,a]=e,t=ge):[t,n,l,a]=e,!t)return te;let i=te;const s=r((()=>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,l,a),i=()=>{e.removeEventListener(n,l,a),i=te})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return Z(c),c}ee&&window.navigator,ee&&window.location;const we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ye="__vueuse_ssr_handlers__";we[ye]=we[ye]||{};const be=we[ye];const ke={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 Ce(e,t,l,r={}){var a;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:p=ge,eventFilter:v,onError:g=(e=>{console.error(e)})}=r,f=(d?i:n)(t);if(!l)try{l=function(e,t){return be[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=ge)?void 0:e.localStorage}))()}catch(e){g(e)}if(!l)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=r.serializer)?a:ke[w],{pause:b,resume:k}=ve(f,(()=>function(t){try{null==t?l.removeItem(e):l.setItem(e,y.write(t))}catch(e){g(e)}}(f.value)),{flush:s,deep:c,eventFilter:v});return p&&u&&he(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:l.getItem(e);return null==n?(m&&null!==h&&l.setItem(e,y.write(h)),h):"string"!=typeof n?n:y.read(n)}catch(e){g(e)}finally{k()}}}(t))}}var $e,Ie,Le=Object.defineProperty,je=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Re=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Se(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:l=ge}=t,r=n(!1);let a=null;function i(){r.value&&l&&(e(),a=l.requestAnimationFrame(i))}function s(){!r.value&&l&&(r.value=!0,i())}function c(){r.value=!1,null!=a&&l&&(l.cancelAnimationFrame(a),a=null)}return o&&s(),Z(c),{isActive:r,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&&ee&&p(),l(t)&&Z(r(t,(()=>{i&&ee&&p()})));return Z(d),{isActive:u,pause:d,resume:p}}(s,a,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))xe.call(t,n)&&Re(e,n,t[n]);if(je)for(var n of je(t))Ee.call(t,n)&&Re(e,n,t[n]);return e})({now:i},c):i}ee&&(null==window?void 0:window.navigator)&&(null==($e=null==window?void 0:window.navigator)?void 0:$e.platform)&&/iP(ad|hone|od)/.test(null==(Ie=null==window?void 0:window.navigator)?void 0:Ie.platform);let Ae=0;const Ue=e=>{try{e=decodeURI(e)}catch(e){}return e},ze=(e="")=>e.replace(/\/$/u,""),Me=e=>/^(https?:)?\/\//.test(e),Oe=e=>{const t=ze(e);return Me(t)?t:`https://${t}`},Pe=e=>Array.isArray(e)?e:!!e&&[0,e],Ne=(e,t)=>"function"==typeof e?e:!1!==e&&t,Te="{--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}",_e=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Be=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),r=Math.floor(l/864e5);if(0===r){const e=l%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 r<0?n.now:r<8?`${r} ${n.days}`:(e=>{const t=_e(e.getDate(),2),n=_e(e.getMonth()+1,2);return`${_e(e.getFullYear(),2)}-${n}-${t}`})(o)},Fe=e=>{const t=Ce("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 l={folder:e,...o};return n&&(t.value[e]=l),l}))},De=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,He=e=>{"AbortError"!==e.name&&console.error(e.message)},We=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},qe=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>We(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),Ve=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>We(e,"visit count"))),Je=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Ke=e=>e.type.includes("image"),Ye=e=>{const t=Array.from(e).find(Ke);return t?t.getAsFile():null},Ge=/\$.*?\$/,Xe=/^\$(.*?)\$/,Qe=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ze=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),et=(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=Qe.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(Ge);return-1!==t?t:e.length},tokenizer(t){const n=Xe.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);O.use({extensions:e})}return O.parse(Ze(e,t))},tt=e=>e.dataset.path||e.getAttribute("id"),nt=()=>Ce("USER_KEY",{}),ot=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{var l;const r=new AbortController,a=document.querySelectorAll(n),i=nt();return a.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:l})=>{const r={};return l&&(r.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:r}).then((e=>e.json())).then((e=>We(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(a).map((e=>Ue(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:r.signal,token:null===(l=i.value)||void 0===l?void 0:l.token}).then((e=>{a.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(He),r.abort.bind(r)},lt=({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 rt=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:lt},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"),l=Ce("WALINE_COMMENT_BOX_EDITOR",""),a=Ce("WALINE_USER_META",{nick:"",mail:"",link:""}),i=nt(),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),x=s((()=>o.value.locale)),E=s((()=>{var e;return Boolean(null===(e=i.value)||void 0===e?void 0:e.token)})),R=s((()=>!1!==o.value.imageUploader)),S=e=>{const t=u.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=`![${o.value.locale.uploading} ${e.name}]()`;return S(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{l.value=l.value.replace(t,`\r\n`)}))},U=()=>{var n,r,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===(r=c.value.nick)||void 0===r||r.focus(),alert(x.value.nickError);if(w.indexOf("mail")>-1&&!y.mail||y.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(y.mail))return null===(s=c.value.mail)||void 0===s||s.focus(),alert(x.value.mailError);if(!y.comment)return void(null===(m=u.value)||void 0===m||m.focus());y.nick||(y.nick=x.value.anonymous)}if(!I.value)return alert(x.value.wordHint.replace("$0",f[0].toString()).replace("$1",f[1].toString()).replace("$2",C.value.toString()));y.comment=Ze(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 l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,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),l.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 r([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),r((()=>l.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;L.value=e,k.value=et(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}),r((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?Fe(ze(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:r,type:a,items:i}=e;t.tabs.push({name:n,icon:De(l,o,r,a),items:i.map((e=>{const n=`${r||""}${e}`;return t.map[n]=De(e,o,r,a),n}))})})),t}))).then((e=>{h.value=e}));var t}),{immediate:!0})})),p((()=>{document.body.removeEventListener("click",z)})),{config:o,locale:x,insert:S,onChange:()=>{const e=v.value;e.files&&R.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=Ye(e.dataTransfer.items);t&&R.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=Ye(e.clipboardData.items);t&&R.value&&A(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,r=(window.innerHeight-450)/2,a=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${r},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,l=(window.innerWidth-800)/2,r=(window.innerHeight-800)/2,a=window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${r},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:E,userInfo:i,isSubmitting:j,wordNumber:C,wordLimit:$,isWordNumberLegal:I,editor:l,userMeta:a,emoji:h,emojiTabIndex:w,showEmoji:y,canUploadImage:R,previewText:k,showPreview:b,inputRefs:c,editorRef:u,emojiButtonRef:g,emojiPopupRef:f,imageUploadRef:v}}});const at={class:"wl-comment"},it={key:0,class:"wl-login-info"},st={class:"wl-avatar"},ct=["title"],ut=["src"],mt=["textContent"],dt={class:"wl-panel"},pt=["for","textContent"],vt=["id","name","type","onUpdate:modelValue"],gt=["placeholder"],ft={class:"wl-preview"},ht=h("hr",null,null,-1),wt=["innerHTML"],yt={class:"wl-footer"},bt={class:"wl-actions"},kt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Ct=["title"],$t=["title"],It=["title"],Lt={class:"wl-info"},jt={class:"wl-text-number"},xt={key:0},Et=E(" / "),Rt=["textContent"],St=["textContent"],At=["disabled"],Ut={key:0,class:"wl-tab-wrapper"},zt=["title","onClick"],Mt=["src","alt"],Ot={key:0,class:"wl-tabs"},Pt=["onClick"],Nt=["src","alt","title"],Tt=["title"];rt.render=function(e,t,n,o,l,r){const a=v("CloseIcon"),i=v("MarkdownIcon"),s=v("EmojiIcon"),c=v("ImageIcon"),u=v("PreviewIcon"),m=v("LoadingIcon");return g(),f("div",at,["disable"!==e.config.login&&e.isLogin?(g(),f("div",it,[h("div",st,[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,ct),h("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,ut)]),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,mt)])):b("v-if",!0),h("div",dt,["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,pt),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,vt),[[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,gt),[[j,e.editor]]),I(h("div",ft,[ht,h("h4",null,y(e.locale.preview)+":",1),h("div",{class:"wl-content",innerHTML:e.previewText},null,8,wt)],512),[[x,e.showPreview]]),h("div",yt,[h("div",bt,[h("a",kt,[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,Ct),[[x,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,$t)):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,It)]),h("div",Lt,[h("div",jt,[E(y(e.wordNumber)+" ",1),e.config.wordLimit?(g(),f("span",xt,[Et,h("span",{class:k({illegal:!e.isWordNumberLegal}),textContent:y(e.wordLimit)},null,10,Rt)])):b("v-if",!0),E(" "+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,St)),"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(),R(m,{key:0,size:16})):(g(),f(C,{key:1},[E(y(e.locale.submit),1)],2112))],8,At)):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",Ut,[(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,Mt)):b("v-if",!0)],8,zt)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(g(),f("div",Ot,[(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,Nt)],10,Pt)))),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,Tt)):b("v-if",!0)])},rt.__file="src/components/CommentBox.vue";var _t=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:rt,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?Me(t)?t:`https://${t}`:""})),l=((e,t)=>{const n=Se();return s((()=>Be(e,n.value,t)))})(e.comment.insertedAt,n.value),r=s((()=>{var t;return e.comment.objectId===(null===(t=e.reply)||void 0===t?void 0:t.objectId)}));return{config:t,locale:n,isReplyingCurrent:r,link:o,time:l}}});const Bt=["id"],Ft={class:"wl-user","aria-hidden":"true"},Dt=["src"],Ht={class:"wl-card"},Wt={class:"wl-head"},qt=["href"],Vt={key:1,class:"wl-nick"},Jt=["textContent"],Kt=["textContent"],Yt=["textContent"],Gt=["textContent"],Xt=["textContent"],Qt=["title"],Zt={class:"wl-meta","aria-hidden":"true"},en=["textContent"],tn=["textContent"],nn=["textContent"],on=["innerHTML"],ln={key:0,class:"wl-reply-wrapper"},rn={key:1,class:"wl-quote"};_t.render=function(e,t,n,o,l,r){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",Ft,[e.comment.avatar?(g(),f("img",{key:0,src:e.comment.avatar},null,8,Dt)):b("v-if",!0),e.comment.type?(g(),R(a,{key:1})):b("v-if",!0)]),h("div",Ht,[h("div",Wt,[e.link?(g(),f("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},y(e.comment.nick),9,qt)):(g(),f("span",Vt,y(e.comment.nick),1)),"administrator"===e.comment.type?(g(),f("span",{key:2,class:"wl-badge",textContent:y(e.locale.admin)},null,8,Jt)):b("v-if",!0),e.comment.label?(g(),f("span",{key:3,class:"wl-badge",textContent:y(e.comment.label)},null,8,Kt)):b("v-if",!0),e.comment.sticky?(g(),f("span",{key:4,class:"wl-badge",textContent:y(e.locale.sticky)},null,8,Yt)):b("v-if",!0),e.comment.level>=0?(g(),f("span",{key:5,class:k(`wl-badge level${e.comment.level}`),textContent:y(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,Gt)):b("v-if",!0),h("span",{class:"wl-time",textContent:y(e.time)},null,8,Xt),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,Qt)]),h("div",Zt,[e.comment.addr?(g(),f("span",{key:0,textContent:y(e.comment.addr)},null,8,en)):b("v-if",!0),e.comment.browser?(g(),f("span",{key:1,textContent:y(e.comment.browser)},null,8,tn)):b("v-if",!0),e.comment.os?(g(),f("span",{key:2,textContent:y(e.comment.os)},null,8,nn)):b("v-if",!0)]),h("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,on),e.isReplyingCurrent?(g(),f("div",ln,[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",rn,[(g(!0),f(C,null,$(e.comment.children,(n=>(g(),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))])):b("v-if",!0)])],8,Bt)},_t.__file="src/components/CommentCard.vue";var an=u({name:"WalineRoot",components:{CommentBox:rt,CommentCard:_t,LoadingIcon:lt},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:r=["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:Oe(e),path:Ue(t),locale:{...Q[n]||Q["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Pe(c),meta:N(r),requiredMeta:N(a),imageUploader:Ne(u,T),highlighter:Ne(m,H),texRenderer:Ne(d,_),lang:n,dark:i,emoji:l,pageSize:s,login:v,copyright:p,...g}))(e))),o=nt(),l=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${Te}}`:`${e}${Te}`:!0===e?`:root${Te}`:"";var e}));let g;!function(e,t={}){const o=n(!1),{document:l=fe,immediate:i=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++Ae}=t,u=n(e);let m=()=>{};const d=()=>{if(!l)return;const e=l.getElementById(c)||l.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),l.head.appendChild(e),o.value||(m=r(u,(t=>{e.innerText=t}),{immediate:!0}),o.value=!0)},p=()=>{l&&o.value&&(m(),l.head.removeChild(l.getElementById(c)),o.value=!1)};i&&!s&&d(),s||Z(p),a(o)}(v);const f=e=>{var n;const{serverURL:r,path:a,pageSize:s}=t.value,d=new AbortController;l.value="loading",null==g||g(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:r,token:a})=>{const i={};return a&&(i.Authorization=`Bearer ${a}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:r,headers:i}).then((e=>e.json())).then((e=>We(e,"comment list")))})({serverURL:r,lang:t.value.lang,path:a,pageSize:s,page:e,signal:d.signal,token:null===(n=o.value)||void 0===n?void 0:n.token}).then((t=>{l.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),l.value="error")})),g=d.abort.bind(d)},h=()=>{i.value=0,m.value=[],f(1)};return S("config",t),r((()=>e.path),h),d((()=>h())),{config:t,darkmodeStyle:v,i18n:s((()=>t.value.locale)),status:l,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.3.2"}}});const sn={"data-waline":""},cn={class:"wl-count"},un=["textContent"],mn={class:"wl-cards"},dn={key:1,class:"wl-operation"},pn=["textContent"],vn={key:0,class:"wl-loading"},gn=["textContent"],fn={class:"wl-operation"},hn=["textContent"],wn={key:3,class:"wl-power"},yn=E(" Powered by "),bn=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);an.render=function(e,t,n,o,l,r){const a=v("CommentBox"),i=v("CommentCard"),s=v("LoadingIcon");return g(),f("div",sn,[e.reply?b("v-if",!0):(g(),R(a,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),h("div",cn,[e.count?(g(),f("span",{key:0,class:"wl-num",textContent:y(e.count)},null,8,un)):b("v-if",!0),E(" "+y(e.i18n.comment),1)]),h("div",mn,[(g(!0),f(C,null,$(e.data,(t=>(g(),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?(g(),f("div",dn,[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,pn)])):(g(),f(C,{key:2},["loading"===e.status?(g(),f("div",vn,[w(s,{size:30})])):e.data.length?e.page<e.totalPages?(g(),f(C,{key:2},[b(" Load more button "),h("div",fn,[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,hn)])],2112)):b("v-if",!0):(g(),f("div",{key:1,class:"wl-empty",textContent:y(e.i18n.sofa)},null,8,gn))],2112)),b(" Copyright Information "),e.config.copyright?(g(),f("div",wn,[yn,bn,E(" v"+y(e.version),1)])):b("v-if",!0)])},an.__file="src/components/Waline.vue";const kn=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},Cn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:l="zh-CN"})=>{const r=new AbortController,a=Array.from(document.querySelectorAll(n)),i=e=>{const n=tt(e);return null!==n&&t!==n},s=n=>qe({serverURL:e,paths:n.map((e=>tt(e)||t)),lang:l,signal:r.signal}).then((e=>kn(e,n))).catch(He);if(o){const n=a.filter((e=>!i(e))),o=a.filter(i);Ve({serverURL:e,path:t,lang:l}).then((e=>kn(new Array(n.length).fill(e),n))),o.length&&s(o)}else s(a);return r.abort.bind(r)},$n=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:o=!1,...l})=>{const r=e?Je(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!l.serverURL)throw new Error("Option 'serverURL' is missing!");const a=A({...l}),i=A({comment:n,pageview:o,path:t}),s=()=>{i.comment&&ot({serverURL:a.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})},u=()=>{i.pageview&&Cn({serverURL:a.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})},m=r?U((()=>c(an,{path:i.path,...a}))):null;m&&m.mount(r),s(),u();const d=z(s),p=z(u);return{el:r,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()}}},In="2.3.2",Ln=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{var l;const r=nt(),a=Je(e),i=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:l})=>{const r={};return l&&(r.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:r}).then((e=>e.json())).then((e=>We(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:i.signal,token:null===(l=r.value)||void 0===l?void 0:l.token}).then((e=>a&&e.length?(a.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{i.abort(),a.innerHTML=""}}):{comments:e,destroy:()=>i.abort()}))};export{Ln as RecentComments,ot as commentCount,Q as defaultLocales,$n as init,Cn as pageviewCount,In as version};
|
|
1
|
+
import{getCurrentScope as e,onScopeDispose as t,ref as n,unref as o,isRef as l,watch as a,readonly as r,shallowRef as i,computed as s,h as c,defineComponent as u,inject as m,onMounted as d,onUnmounted as v,resolveComponent as p,openBlock as g,createElementBlock as h,createElementVNode as f,createVNode as w,toDisplayString as y,createCommentVNode as b,normalizeClass as k,Fragment as C,renderList as $,withDirectives as L,vModelDynamic as I,vModelText as j,vShow as R,createTextVNode as S,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";const P=["nick","mail","link"],N=e=>e.filter((e=>P.includes(e))),T=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})),_=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>',B=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),D=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],F={},H=e=>{let t=0;return e.replace(B,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"<";let l;F[n]?l=F[n]:(l=D[t],F[n]=l);const a=`<span style="color: #${l}">${n}</span>`;return t=++t%D.length,a}))},V=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5"],W=e=>Object.fromEntries(e.map(((e,t)=>[V[t],e])));var q=W(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words","Please input comments between $0 and $1 words!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar"]),J=W(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名"]),K=W(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说"]),Y=W(["暱稱","郵箱","網址","可選","暱稱不能少於3個字元","請填寫正確的郵件地址","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說"]),G=W(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo"]),X=W(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный"]);const Q={zh:K,"zh-cn":K,"zh-CN":K,"zh-tw":Y,"zh-TW":Y,en:q,"en-US":q,"en-us":q,jp:J,"jp-jp":J,"jp-JP":J,"pt-br":G,"pt-BR":G,ru:X,"ru-ru":X,"ru-RU":X};function Z(n){return!!e()&&(t(n),!0)}const ee="undefined"!=typeof window,te=()=>{};const ne=e=>e();var oe=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;function re(e,t,n={}){const o=n,{eventFilter:l=ne}=o,r=((e,t)=>{var n={};for(var o in e)le.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&oe)for(var o of oe(e))t.indexOf(o)<0&&ae.call(e,o)&&(n[o]=e[o]);return n})(o,["eventFilter"]);return a(e,(i=l,s=t,function(...e){i((()=>s.apply(this,e)),{fn:s,thisArg:this,args:e})}),r);var i,s}var ie=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,ve=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function pe(e,t,o={}){const l=o,{eventFilter:a}=l,r=((e,t)=>{var n={};for(var o in e)me.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&ue)for(var o of ue(e))t.indexOf(o)<0&&de.call(e,o)&&(n[o]=e[o]);return n})(l,["eventFilter"]),{eventFilter:i,pause:s,resume:c,isActive:u}=function(e=ne){const t=n(!0);return{isActive:t,pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(a),m=re(e,t,(d=((e,t)=>{for(var n in t||(t={}))me.call(t,n)&&ve(e,n,t[n]);if(ue)for(var n of ue(t))de.call(t,n)&&ve(e,n,t[n]);return e})({},r),se(d,ce({eventFilter:i}))));var d;return{stop:m,pause:s,resume:c,isActive:u}}const ge=ee?window:void 0,he=ee?window.document:void 0;function fe(...e){let t,n,l,r;if("string"==typeof e[0]?([n,l,r]=e,t=ge):[t,n,l,r]=e,!t)return te;let i=te;const s=a((()=>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,l,r),i=()=>{e.removeEventListener(n,l,r),i=te})}),{immediate:!0,flush:"post"}),c=()=>{s(),i()};return Z(c),c}ee&&window.navigator,ee&&window.location;const we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ye="__vueuse_ssr_handlers__";we[ye]=we[ye]||{};const be=we[ye];const ke={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 Ce(e,t,l,a={}){var r;const{flush:s="pre",deep:c=!0,listenToStorageChanges:u=!0,writeDefaults:m=!0,shallow:d,window:v=ge,eventFilter:p,onError:g=(e=>{console.error(e)})}=a,h=(d?i:n)(t);if(!l)try{l=function(e,t){return be[e]||t}("getDefaultStorage",(()=>{var e;return null==(e=ge)?void 0:e.localStorage}))()}catch(e){g(e)}if(!l)return h;const f=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"}(f),y=null!=(r=a.serializer)?r:ke[w],{pause:b,resume:k}=pe(h,(()=>function(t){try{null==t?l.removeItem(e):l.setItem(e,y.write(t))}catch(e){g(e)}}(h.value)),{flush:s,deep:c,eventFilter:p});return v&&u&&fe(v,"storage",C),C(),h;function C(t){t&&t.key!==e||(h.value=function(t){if(!t||t.key===e){b();try{const n=t?t.newValue:l.getItem(e);return null==n?(m&&null!==f&&l.setItem(e,y.write(f)),f):"string"!=typeof n?n:y.read(n)}catch(e){g(e)}finally{k()}}}(t))}}var $e,Le,Ie=Object.defineProperty,je=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,xe=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Ee(e={}){const{controls:t=!1,interval:r="requestAnimationFrame"}=e,i=n(new Date),s=()=>i.value=new Date,c="requestAnimationFrame"===r?function(e,t={}){const{immediate:o=!0,window:l=ge}=t,a=n(!1);let r=null;function i(){a.value&&l&&(e(),r=l.requestAnimationFrame(i))}function s(){!a.value&&l&&(a.value=!0,i())}function c(){a.value=!1,null!=r&&l&&(l.cancelAnimationFrame(r),r=null)}return o&&s(),Z(c),{isActive:a,pause:c,resume:s}}(s,{immediate:!0}):function(e,t=1e3,r={}){const{immediate:i=!0,immediateCallback:s=!1}=r;let c=null;const u=n(!1);function m(){c&&(clearInterval(c),c=null)}function d(){u.value=!1,m()}function v(){t<=0||(u.value=!0,s&&e(),m(),c=setInterval(e,o(t)))}i&&ee&&v(),l(t)&&Z(a(t,(()=>{i&&ee&&v()})));return Z(d),{isActive:u,pause:d,resume:v}}(s,r,{immediate:!0});return t?((e,t)=>{for(var n in t||(t={}))Re.call(t,n)&&xe(e,n,t[n]);if(je)for(var n of je(t))Se.call(t,n)&&xe(e,n,t[n]);return e})({now:i},c):i}ee&&(null==window?void 0:window.navigator)&&(null==($e=null==window?void 0:window.navigator)?void 0:$e.platform)&&/iP(ad|hone|od)/.test(null==(Le=null==window?void 0:window.navigator)?void 0:Le.platform);let Ae=0;const Ue=e=>{try{e=decodeURI(e)}catch(e){}return e},ze=(e="")=>e.replace(/\/$/u,""),Me=e=>/^(https?:)?\/\//.test(e),Oe=e=>{const t=ze(e);return Me(t)?t:`https://${t}`},Pe=e=>Array.isArray(e)?e:!!e&&[0,e],Ne=(e,t)=>"function"==typeof e?e:!1!==e&&t,Te="{--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}",_e=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},Be=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,l=t.getTime()-o.getTime(),a=Math.floor(l/864e5);if(0===a){const e=l%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 a<0?n.now:a<8?`${a} ${n.days}`:(e=>{const t=_e(e.getDate(),2),n=_e(e.getMonth()+1,2);return`${_e(e.getFullYear(),2)}-${n}-${t}`})(o)},De=e=>{const t=Ce("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 l={folder:e,...o};return n&&(t.value[e]=l),l}))},Fe=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,He=e=>{"AbortError"!==e.name&&console.error(e.message)},Ve={"Content-Type":"application/json"},We=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},qe=({serverURL:e,lang:t,token:n,objectId:o,...l})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(l)}).then((e=>e.json())),Je=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>We(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),Ke=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:Ve,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>We(e,"visit count"))),Ye=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,Ge=e=>e.type.includes("image"),Xe=e=>{const t=Array.from(e).find(Ge);return t?t.getAsFile():null},Qe=/\$.*?\$/,Ze=/^\$(.*?)\$/,et=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,tt=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),nt=(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=et.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(Qe);return-1!==t?t:e.length},tokenizer(t){const n=Ze.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(o);O.use({extensions:e})}return O.parse(tt(e,t))},ot=e=>e.dataset.path||e.getAttribute("id"),lt=()=>Ce("USER_KEY",{}),at=()=>Ce("WALIKE_LIKE",[]),rt=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{var l;const a=new AbortController,r=document.querySelectorAll(n),i=lt();return r.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:a}).then((e=>e.json())).then((e=>We(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:e,paths:Array.from(r).map((e=>Ue(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:a.signal,token:null===(l=i.value)||void 0===l?void 0:l.token}).then((e=>{r.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(He),a.abort.bind(a)},it=({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 st=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:it},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"),l=Ce("WALINE_COMMENT_BOX_EDITOR",""),r=Ce("WALINE_USER_META",{nick:"",mail:"",link:""}),i=lt(),c=n({}),u=n(null),p=n(null),g=n(null),h=n(null),f=n({tabs:[],map:{}}),w=n(0),y=n(!1),b=n(!1),k=n(""),C=n(0),$=n(0),L=n(!1),I=n(""),j=n(!1),R=s((()=>o.value.locale)),S=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,a=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=a},A=e=>{const t=`![${o.value.locale.uploading} ${e.name}]()`;return E(t),Promise.resolve().then((()=>o.value.imageUploader(e))).then((n=>{l.value=l.value.replace(t,`\r\n`)}))},U=()=>{var n,a,s,m,d;const{serverURL:v,lang:p,login:g,wordLimit:h,requiredMeta:w}=o.value,y={comment:I.value,nick:r.value.nick,mail:r.value.mail,link:r.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===(a=c.value.nick)||void 0===a||a.focus(),alert(R.value.nickError);if(w.indexOf("mail")>-1&&!y.mail||y.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(y.mail))return null===(s=c.value.mail)||void 0===s||s.focus(),alert(R.value.mailError);if(!y.comment)return void(null===(m=u.value)||void 0===m||m.focus());y.nick||(y.nick=R.value.anonymous)}if(!L.value)return alert(R.value.wordHint.replace("$0",h[0].toString()).replace("$1",h[1].toString()).replace("$2",C.value.toString()));y.comment=tt(y.comment,f.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 l={"Content-Type":"application/json"};return n&&(l.Authorization=`Bearer ${n}`),fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:l,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:v,lang:p,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),l.value="",k.value="",e.replyId&&t("cancel-reply")})).catch((e=>{j.value=!1,alert(e.message)}))},z=e=>{g.value.contains(e.target)||h.value.contains(e.target)||(y.value=!1)};return a([o,C],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?($.value=n[0],L.value=!1):t>n[1]?($.value=n[1],L.value=!1):($.value=n[1],L.value=!0):($.value=0,L.value=!0)}),{immediate:!0}),d((()=>{document.body.addEventListener("click",z),a((()=>l.value),(e=>{const{highlighter:t,texRenderer:n}=o.value;I.value=e,k.value=nt(e,{emojiMap:f.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}),a((()=>o.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?De(ze(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:l,prefix:a,type:r,items:i}=e;t.tabs.push({name:n,icon:Fe(l,o,a,r),items:i.map((e=>{const n=`${a||""}${e}`;return t.map[n]=Fe(e,o,a,r),n}))})})),t}))).then((e=>{f.value=e}));var t}),{immediate:!0})})),v((()=>{document.body.removeEventListener("click",z)})),{config:o,locale:R,insert:E,onChange:()=>{const e=p.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=Xe(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=Xe(e.clipboardData.items);t&&x.value&&A(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=o.value,l=(window.innerWidth-450)/2,a=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);null==r||r.postMessage({type:"TOKEN",data:null},"*");const s=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(null==r||r.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,l=(window.innerWidth-800)/2,a=(window.innerHeight-800)/2,r=window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${l},top=${a},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);null==r||r.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:S,userInfo:i,isSubmitting:j,wordNumber:C,wordLimit:$,isWordNumberLegal:L,editor:l,userMeta:r,emoji:f,emojiTabIndex:w,showEmoji:y,canUploadImage:x,previewText:k,showPreview:b,inputRefs:c,editorRef:u,emojiButtonRef:g,emojiPopupRef:h,imageUploadRef:p}}});const ct={class:"wl-comment"},ut={key:0,class:"wl-login-info"},mt={class:"wl-avatar"},dt=["title"],vt=["src"],pt=["textContent"],gt={class:"wl-panel"},ht=["for","textContent"],ft=["id","name","type","onUpdate:modelValue"],wt=["placeholder"],yt={class:"wl-preview"},bt=f("hr",null,null,-1),kt=["innerHTML"],Ct={class:"wl-footer"},$t={class:"wl-actions"},Lt={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},It=["title"],jt=["title"],Rt=["title"],St={class:"wl-info"},xt={class:"wl-text-number"},Et={key:0},At=S(" / "),Ut=["textContent"],zt=["textContent"],Mt=["disabled"],Ot={key:0,class:"wl-tab-wrapper"},Pt=["title","onClick"],Nt=["src","alt"],Tt={key:0,class:"wl-tabs"},_t=["onClick"],Bt=["src","alt","title"],Dt=["title"];st.render=function(e,t,n,o,l,a){const r=p("CloseIcon"),i=p("MarkdownIcon"),s=p("EmojiIcon"),c=p("ImageIcon"),u=p("PreviewIcon"),m=p("LoadingIcon");return g(),h("div",ct,["disable"!==e.config.login&&e.isLogin?(g(),h("div",ut,[f("div",mt,[f("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:t[0]||(t[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[w(r,{size:14})],8,dt),f("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,vt)]),f("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,pt)])):b("v-if",!0),f("div",gt,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(g(),h("div",{key:0,class:k(["wl-header",`item${e.config.meta.length}`])},[(g(!0),h(C,null,$(e.config.meta,(t=>(g(),h("div",{class:"wl-header-item",key:t},[f("label",{for:t,textContent:y(e.locale[t]+(e.config.requiredMeta.includes(t)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,ht),L(f("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,ft),[[I,e.userMeta[t]]])])))),128))],2)):b("v-if",!0),L(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,wt),[[j,e.editor]]),L(f("div",yt,[bt,f("h4",null,y(e.locale.preview)+":",1),f("div",{class:"wl-content",innerHTML:e.previewText},null,8,kt)],512),[[R,e.showPreview]]),f("div",Ct,[f("div",$t,[f("a",Lt,[w(i)]),L(f("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,It),[[R,e.emoji.tabs.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?(g(),h("label",{key:0,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[w(c)],8,jt)):b("v-if",!0),f("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,Rt)]),f("div",St,[f("div",xt,[S(y(e.wordNumber)+" ",1),e.config.wordLimit?(g(),h("span",Et,[At,f("span",{class:k({illegal:!e.isWordNumberLegal}),textContent:y(e.wordLimit)},null,10,Ut)])):b("v-if",!0),S(" "+y(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?b("v-if",!0):(g(),h("button",{key:0,class:"wl-btn",onClick:t[9]||(t[9]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:y(e.locale.login)},null,8,zt)),"force"!==e.config.login||e.isLogin?(g(),h("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(),h(C,{key:1},[S(y(e.locale.submit),1)],2112))],8,Mt)):b("v-if",!0)]),f("div",{ref:"emojiPopupRef",class:k(["wl-emoji-popup",{display:e.showEmoji}])},[(g(!0),h(C,null,$(e.emoji.tabs,((t,n)=>(g(),h(C,{key:t.name},[n===e.emojiTabIndex?(g(),h("div",Ot,[(g(!0),h(C,null,$(t.items,(t=>(g(),h("button",{key:t,title:t,onClick:n=>e.insert(`:${t}:`)},[e.showEmoji?(g(),h("img",{key:0,class:"wl-emoji",src:e.emoji.map[t],alt:t,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Nt)):b("v-if",!0)],8,Pt)))),128))])):b("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(g(),h("div",Tt,[(g(!0),h(C,null,$(e.emoji.tabs,((t,n)=>(g(),h("button",{key:t.name,class:k(["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,Bt)],10,_t)))),128))])):b("v-if",!0)],2)])]),e.replyId?(g(),h("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:t[11]||(t[11]=t=>e.$emit("cancel-reply"))},[w(r,{size:24})],8,Dt)):b("v-if",!0)])},st.__file="src/components/CommentBox.vue";const Ft=["approved","waiting","spam"];var Ht=u({props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object}},components:{CommentBox:st,DeleteIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z",fill:"red"})),LikeIcon:({active:e=!1})=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[c("path",{d:"M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z"+(e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"),fill:e?"red":"currentColor"})]),ReplyIcon:()=>c("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},c("path",{d:"M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z",fill:"currentColor"})),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","like","delete","status","sticky"],setup(e){const t=m("config"),n=at(),o=lt(),l=s((()=>t.value.locale)),a=s((()=>{let{link:t}=e.comment;return t?Me(t)?t:`https://${t}`:""})),r=s((()=>n.value.includes(e.comment.objectId))),i=((e,t)=>{const n=Ee();return s((()=>Be(e,n.value,t)))})(e.comment.insertedAt,l.value),c=s((()=>"administrator"===o.value.type)),u=s((()=>e.comment.user_id&&o.value.objectId===e.comment.user_id)),d=s((()=>{var t;return e.comment.objectId===(null===(t=e.reply)||void 0===t?void 0:t.objectId)}));return{config:t,locale:l,isReplyingCurrent:d,link:a,like:r,time:i,isAdmin:c,isOwner:u,commentStatus:Ft}}});const Vt=["id"],Wt={class:"wl-user","aria-hidden":"true"},qt=["src"],Jt={class:"wl-card"},Kt={class:"wl-head"},Yt=["href"],Gt={key:1,class:"wl-nick"},Xt=["textContent"],Qt=["textContent"],Zt=["textContent"],en=["textContent"],tn=["textContent"],nn=["title"],on=["title"],ln=["textContent"],an={class:"wl-meta","aria-hidden":"true"},rn=["textContent"],sn=["textContent"],cn=["textContent"],un=["innerHTML"],mn={key:0,class:"wl-admin-actions"},dn={class:"wl-comment-status"},vn=["disabled","onClick","textContent"],pn={key:1,class:"wl-reply-wrapper"},gn={key:2,class:"wl-quote"};Ht.render=function(e,t,n,o,l,a){const r=p("VerifiedIcon"),i=p("ReplyIcon"),s=p("LikeIcon"),c=p("DeleteIcon"),u=p("CommentBox"),m=p("CommentCard",!0);return g(),h("div",{class:"wl-item",id:e.comment.objectId},[f("div",Wt,[e.comment.avatar?(g(),h("img",{key:0,src:e.comment.avatar},null,8,qt)):b("v-if",!0),e.comment.type?(g(),x(r,{key:1})):b("v-if",!0)]),f("div",Jt,[f("div",Kt,[e.link?(g(),h("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},y(e.comment.nick),9,Yt)):(g(),h("span",Gt,y(e.comment.nick),1)),"administrator"===e.comment.type?(g(),h("span",{key:2,class:"wl-badge",textContent:y(e.locale.admin)},null,8,Xt)):b("v-if",!0),e.comment.label?(g(),h("span",{key:3,class:"wl-badge",textContent:y(e.comment.label)},null,8,Qt)):b("v-if",!0),e.comment.sticky?(g(),h("span",{key:4,class:"wl-badge",textContent:y(e.locale.sticky)},null,8,Zt)):b("v-if",!0),e.comment.level&&e.comment.level>=0?(g(),h("span",{key:5,class:k(`wl-badge level${e.comment.level}`),textContent:y(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,en)):b("v-if",!0),f("span",{class:"wl-time",textContent:y(e.time)},null,8,tn),f("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,nn),f("button",{class:"wl-like",onClick:t[1]||(t[1]=t=>e.$emit("like",e.comment)),title:e.like?e.locale.cancelLike:e.locale.like},[w(s,{active:e.like},null,8,["active"]),"like"in e.comment?(g(),h("span",{key:0,textContent:y(e.comment.like)},null,8,ln)):b("v-if",!0)],8,on),e.isAdmin||e.isOwner?(g(),h("button",{key:6,class:"wl-delete",onClick:t[2]||(t[2]=t=>e.$emit("delete",e.comment))},[w(c)])):b("v-if",!0)]),f("div",an,[e.comment.addr?(g(),h("span",{key:0,textContent:y(e.comment.addr)},null,8,rn)):b("v-if",!0),e.comment.browser?(g(),h("span",{key:1,textContent:y(e.comment.browser)},null,8,sn)):b("v-if",!0),e.comment.os?(g(),h("span",{key:2,textContent:y(e.comment.os)},null,8,cn)):b("v-if",!0)]),f("div",{class:"wl-content",innerHTML:e.comment.comment},null,8,un),e.isAdmin?(g(),h("div",mn,[f("span",dn,[(g(!0),h(C,null,$(e.commentStatus,(t=>(g(),h("button",{key:t,class:k(`wl-btn wl-${t}`),disabled:e.comment.status===t,onClick:n=>e.$emit("status",{status:t,comment:e.comment}),textContent:y(t)},null,10,vn)))),128))]),e.isAdmin&&!e.comment.rid?(g(),h("button",{key:0,class:"wl-btn wl-sticky",onClick:t[3]||(t[3]=t=>e.$emit("sticky",e.comment))},y(e.comment.sticky?"unsticky":"sticky"),1)):b("v-if",!0)])):b("v-if",!0),e.isReplyingCurrent?(g(),h("div",pn,[w(u,{replyId:e.comment.objectId,replyUser:e.comment.nick,rootId:e.rootId,onSubmit:t[4]||(t[4]=t=>e.$emit("submit",t)),onCancelReply:t[5]||(t[5]=t=>e.$emit("reply",null))},null,8,["replyId","replyUser","rootId"])])):b("v-if",!0),e.comment.children?(g(),h("div",gn,[(g(!0),h(C,null,$(e.comment.children,(n=>(g(),x(m,{key:n.objectId,comment:n,reply:e.reply,rootId:e.rootId,onReply:t[6]||(t[6]=t=>e.$emit("reply",t)),onSubmit:t[7]||(t[7]=t=>e.$emit("submit",t)),onLike:t[8]||(t[8]=t=>e.$emit("like",t)),onStatus:t[9]||(t[9]=t=>e.$emit("status",t)),onSticky:t[10]||(t[10]=t=>e.$emit("sticky",t))},null,8,["comment","reply","rootId"])))),128))])):b("v-if",!0)])],8,Vt)},Ht.__file="src/components/CommentCard.vue";var hn=u({name:"WalineRoot",components:{CommentBox:st,CommentCard:Ht,LoadingIcon:it},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","copyright"],setup(e){const t=s((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:l=["//unpkg.com/@waline/emojis@1.0.1/weibo"],meta:a=["nick","mail","link"],requiredMeta:r=[],dark:i=!1,pageSize:s=10,wordLimit:c,imageUploader:u,highlighter:m,texRenderer:d,copyright:v=!0,login:p="enable",...g})=>({serverURL:Oe(e),path:Ue(t),locale:{...Q[n]||Q["zh-CN"],..."object"==typeof o?o:{}},wordLimit:Pe(c),meta:N(a),requiredMeta:N(r),imageUploader:Ne(u,T),highlighter:Ne(m,H),texRenderer:Ne(d,_),lang:n,dark:i,emoji:l,pageSize:s,login:p,copyright:v,...g}))(e))),o=lt(),l=at(),i=n("loading"),c=n(0),u=n(1),m=n(0),v=n([]),p=n(null),g=s((()=>{return"string"==typeof(e=t.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${Te}}`:`${e}${Te}`:!0===e?`:root${Te}`:"";var e}));let h;!function(e,t={}){const o=n(!1),{document:l=he,immediate:i=!0,manual:s=!1,id:c="vueuse_styletag_"+ ++Ae}=t,u=n(e);let m=()=>{};const d=()=>{if(!l)return;const e=l.getElementById(c)||l.createElement("style");e.type="text/css",e.id=c,t.media&&(e.media=t.media),l.head.appendChild(e),o.value||(m=a(u,(t=>{e.innerText=t}),{immediate:!0}),o.value=!0)},v=()=>{l&&o.value&&(m(),l.head.removeChild(l.getElementById(c)),o.value=!1)};i&&!s&&d(),s||Z(v),r(o)}(g);const f=e=>{var n;const{serverURL:l,path:a,pageSize:r}=t.value,s=new AbortController;i.value="loading",null==h||h(),(({serverURL:e,lang:t,path:n,page:o,pageSize:l,signal:a,token:r})=>{const i={};return r&&(i.Authorization=`Bearer ${r}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${l}&page=${o}&lang=${t}`,{signal:a,headers:i}).then((e=>e.json())).then((e=>We(e,"comment list")))})({serverURL:l,lang:t.value.lang,path:a,pageSize:r,page:e,signal:s.signal,token:null===(n=o.value)||void 0===n?void 0:n.token}).then((t=>{i.value="success",c.value=t.count,v.value.push(...t.data),u.value=e,m.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),i.value="error")})),h=s.abort.bind(s)},w=()=>{c.value=0,v.value=[],f(1)};return E("config",t),a((()=>e.path),w),d((()=>w())),{config:t,darkmodeStyle:g,i18n:s((()=>t.value.locale)),status:i,count:c,page:u,totalPages:m,data:v,reply:p,loadMore:()=>f(u.value+1),refresh:w,onReply:e=>{p.value=e},onSubmit:e=>{if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:n})=>{var l;if(e.status===n)return;const{serverURL:a,lang:r}=t.value;await qe({serverURL:a,lang:r,token:null===(l=o.value)||void 0===l?void 0:l.token,objectId:e.objectId,status:n})},onDelete:async e=>{var n;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:l,lang:a}=t.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:l,lang:a,token:null===(n=o.value)||void 0===n?void 0:n.token,objectId:e.objectId})},onSticky:async e=>{var n;if(e.rid)return;const{serverURL:l,lang:a}=t.value;await qe({serverURL:l,lang:a,token:null===(n=o.value)||void 0===n?void 0:n.token,objectId:e.objectId,sticky:e.sticky?0:1})},onLike:async e=>{const{serverURL:n,lang:o}=t.value,a=l.value.includes(e.objectId);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:Ve,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:n,lang:o,objectId:e.objectId,like:!a}),a?l.value=l.value.filter((t=>t!==e.objectId)):(l.value.push(e.objectId),l.value.length>50&&l.value.slice(-50)),e.like=(e.like||0)+(a?-1:1)},version:"2.4.0"}}});const fn={"data-waline":""},wn={class:"wl-count"},yn=["textContent"],bn={class:"wl-cards"},kn={key:1,class:"wl-operation"},Cn=["textContent"],$n={key:0,class:"wl-loading"},Ln=["textContent"],In={class:"wl-operation"},jn=["textContent"],Rn={key:3,class:"wl-power"},Sn=S(" Powered by "),xn=f("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);hn.render=function(e,t,n,o,l,a){const r=p("CommentBox"),i=p("CommentCard"),s=p("LoadingIcon");return g(),h("div",fn,[e.reply?b("v-if",!0):(g(),x(r,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),f("div",wn,[e.count?(g(),h("span",{key:0,class:"wl-num",textContent:y(e.count)},null,8,yn)):b("v-if",!0),S(" "+y(e.i18n.comment),1)]),f("div",bn,[(g(!0),h(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,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","onReply","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(g(),h("div",kn,[f("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(),h(C,{key:2},["loading"===e.status?(g(),h("div",$n,[w(s,{size:30})])):e.data.length?e.page<e.totalPages?(g(),h(C,{key:2},[b(" Load more button "),f("div",In,[f("button",{type:"button",class:"wl-btn",onClick:t[1]||(t[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:y(e.i18n.more)},null,8,jn)])],2112)):b("v-if",!0):(g(),h("div",{key:1,class:"wl-empty",textContent:y(e.i18n.sofa)},null,8,Ln))],2112)),b(" Copyright Information "),e.config.copyright?(g(),h("div",Rn,[Sn,xn,S(" v"+y(e.version),1)])):b("v-if",!0)])},hn.__file="src/components/Waline.vue";const En=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},An=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:l="zh-CN"})=>{const a=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=ot(e);return null!==n&&t!==n},s=n=>Je({serverURL:e,paths:n.map((e=>ot(e)||t)),lang:l,signal:a.signal}).then((e=>En(e,n))).catch(He);if(o){const n=r.filter((e=>!i(e))),o=r.filter(i);Ke({serverURL:e,path:t,lang:l}).then((e=>En(new Array(n.length).fill(e),n))),o.length&&s(o)}else s(r);return a.abort.bind(a)},Un=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:o=!1,...l})=>{const a=e?Ye(e):null;if(e&&!a)throw new Error("Option 'el' do not match any domElement!");if(!l.serverURL)throw new Error("Option 'serverURL' is missing!");const r=A({...l}),i=A({comment:n,pageview:o,path:t}),s=()=>{i.comment&&rt({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.comment?i.comment:void 0})},u=()=>{i.pageview&&An({serverURL:r.serverURL,path:i.path,selector:"string"==typeof i.pageview?i.pageview:void 0})},m=a?U((()=>c(hn,{path:i.path,...r}))):null;m&&m.mount(a),s(),u();const d=z(s),v=z(u);return{el:a,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{r[e]=t})),i.path=n,void 0!==e&&(i.comment=e),void 0!==t&&(i.pageview=t)},destroy:()=>{null==m||m.unmount(),d(),v()}}},zn="2.4.0",Mn=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{var l;const a=lt(),r=Ye(e),i=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:l})=>{const a={};return l&&(a.Authorization=`Bearer ${l}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:a}).then((e=>e.json())).then((e=>We(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:i.signal,token:null===(l=a.value)||void 0===l?void 0:l.token}).then((e=>r&&e.length?(r.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{i.abort(),r.innerHTML=""}}):{comments:e,destroy:()=>i.abort()}))};export{Mn as RecentComments,rt as commentCount,Q as defaultLocales,Un as init,An as pageviewCount,zn as version};
|
|
2
2
|
//# sourceMappingURL=shim.esm.js.map
|