This repository has been archived on 2024-11-25. You can view files and clone it, but cannot push or open issues or pull requests.

2 lines
141 KiB
JavaScript
Raw Normal View History

2023-10-12 14:01:05 +02:00
!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(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,a=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,o=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&a(e,n,t[n]);if(i)for(var n of i(t))r.call(t,n)&&a(e,n,t[n]);return e},l=(e,i)=>t(e,n(i)),c=(e,t,n)=>(a(e,"symbol"!=typeof t?t+"":t,n),n),d=(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 h(e=""){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild||t}function u(e){return parseFloat(getComputedStyle(e,null).height.replace("px",""))}function p(e){const t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function g(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX}}function m(e,t){let n=e.toString();for(;n.length<t;)n=`0${n}`;return n}function f(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=m(e.getDate(),2),n=m(e.getMonth()+1,2);return`${m(e.getFullYear(),2)}-${n}-${t}`}(e)}catch(n){return console.error(n)," - "}}function k(){return d(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 y(e){let t;try{t=new URL(e)}catch(n){return!1}return"http:"===t.protocol||"https:"===t.protocol}function $(e,t){return function(e,t){return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}(e.conf.server,t)}function x(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]=x(o({},s),r):e[i]=r})),e):t}class v{constructor(e){c(this,"$el"),c(this,"ctx"),c(this,"conf"),this.ctx=e,this.conf=e.conf}$t(e,t={}){return this.ctx.$t(e,t)}}function b(e,t){let n=e.querySelector(":scope > .atk-loading");n||(n=h('<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.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.style.display=""}),500))}function w(e){const t=e.querySelector(":scope > .atk-loading");t&&(t.style.display="none")}function C(e,t=!0){const n=g(e).top+u(e)/2-document.documentElement.clientHeight/2;t?window.scroll({top:n>0?n:0,left:0}):window.scroll(0,n>0?n:0)}function S(e,t,n){const i=h(`<div class="atk-notify atk-fade-in" style="background-color: ${{s:"#57d59f",e:"#ff6f6c",w:"#ffc721",i:"#2ebcfc"}[n]}"><span class="atk-notify-content"></span></div>`);i.querySelector(".atk-notify-content").innerHTML=function(e){c