hugo-theme-next/static/js/3rd/artalk/2.6.4/Artalk.min.js

8 lines
150 KiB
JavaScript
Raw Normal View History

/**
* Skipped minification because the original files appears to be already minified.
* Original file: /npm/artalk@2.6.4/dist/Artalk.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n),__accessCheck=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},__privateAdd=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},__privateMethod=(e,t,n)=>(__accessCheck(e,t,"access private method"),n),__async=(e,t,n)=>new Promise(((i,s)=>{var r=e=>{try{o(n.next(e))}catch(t){s(t)}},a=e=>{try{o(n.throw(e))}catch(t){s(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,a);o((n=n.apply(e,t)).next())}));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Artalk=t()}(this,(function(){var e,t,n,i;function s(e=""){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild||t}function r(e){return parseFloat(getComputedStyle(e,null).height.replace("px",""))}function a(e){const t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function o(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX}}function l(e,t){let n=e.toString();for(;n.length<t;)n=`0${n}`;return n}function c(e,t){try{const n=e.getTime(),i=(new Date).getTime()-n,s=Math.floor(i/864e5);if(0===s){const e=i%864e5,n=Math.floor(e/36e5);if(0===n){const n=e%36e5,i=Math.floor(n/6e4);if(0===i){const e=n%6e4,i=Math.round(e/1e3);return i<10?t.$t("now"):`${i} ${t.$t("seconds")}`}return`${i} ${t.$t("minutes")}`}return`${n} ${t.$t("hours")}`}return s<0?t.$t("now"):s<8?`${s} ${t.$t("days")}`:function(e){const t=l(e.getDate(),2),n=l(e.getMonth()+1,2);return`${l(e.getFullYear(),2)}-${n}-${t}`}(e)}catch(n){return console.error(n)," - "}}function d(){return __async(this,null,(function*(){const e=navigator.userAgent;if(!navigator.userAgentData||!navigator.userAgentData.getHighEntropyValues)return e;const t=navigator.userAgentData;let n=null;try{n=yield t.getHighEntropyValues(["platformVersion"])}catch(s){return console.error(s),e}const i=Number(n.platformVersion.split(".")[0]);return"Windows"===t.platform&&i>=13?e.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===t.platform&&i>=11?e.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):e}))}function h(e){let t;try{t=new URL(e)}catch(n){return!1}return"http:"===t.protocol||"https:"===t.protocol}function u(e,t){return function(e,t){return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}(e.conf.server,t)}function p(e,t){const n=e=>e&&"object"==typeof e;return n(e)&&n(t)?(Object.keys(t).forEach((i=>{const s=e[i],r=t[i];Array.isArray(s)&&Array.isArray(r)?e[i]=s.concat(r):n(s)&&n(r)?e[i]=p(__spreadValues({},s),r):e[i]=r})),e):t}class m{constructor(e){__publicField(this,"$el"),__publicField(this,"ctx"),__publicField(this,"conf"),this.ctx=e,this.conf=e.conf}$t(e,t={}){return this.ctx.$t(e,t)}}function g(e,t){let n=e.querySelector(":scope > .atk-loading");n||(n=s('<div class="atk-loading atk-fade-in" style="display: none;">\n <div class="atk-loading-spinner">\n <svg viewBox="25 25 50 50"><circle cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"></circle></svg>\n </div>\n </div>'),(null==t?void 0:t.transparentBg)&&(n.style.background="transparent"),e.appendChild(n)),n.style.display="";const i=n.querySele